Skip to Content
author's profile photo Former Member
Former Member

Dispaly the data on the screen

Hi

I was trying to create one form for portal with some input fields and a "SAVE" Button. Once I Click on the submit button, it suppose to display the details which I enter. But it is not working. Here is the code. Can you please check the code and correct it?

package Abstract;

import com.sapportals.portal.prt.component.AbstractPortalComponent;

import com.sapportals.portal.prt.component.IPortalComponentRequest;

import com.sapportals.portal.prt.component.IPortalComponentResponse;

import com.sapportals.portal.prt.component.IPortalComponentURI;

import com.sapportals.portal.prt.event.IPortalRequestEvent;

public class UsingAbstractPortalComponent extends AbstractPortalComponent {

private final static int INITIAL_STATE = 0;

private final static int WELCOME_STATE = 1;

private int state = INITIAL_STATE;

private String fname = "";

private String lname = "";

private String sappn = "";

private String email = "";

private String center = "";

private String isuper = "";

private String phno = "";

private IPortalComponentURI uri;

//Fill in your output for "normal" content creation mode here

protected void doContent(IPortalComponentRequest request, IPortalComponentResponse response) {

System.out.println("doContent");

response.write("<h3><font color = blue>eLearning Logon Request</font></h3>");

switch (state) {

case INITIAL_STATE:

if (fname == null)

fname = "";

// create a uri for the event

uri = request.createPortalComponentURI();

uri.setPortalRequestEvent(request.createRequestEvent("compute"));

response.write("<form action=\"" + uri.toString() +

"\" method=\"post\">" + "<table>" + "<tr><td>" + "First Name" + "</td>" +

"<td>" + "<input type=\"text\" fname=\"expression\" value=\"" +

fname + "\">" + "</td></tr>" + "<tr><td>" + "Last Name" + "</td>" +

"<td>" + "<input type=\"text\" lname=\"expression\" value=\"" +

lname + "\">" + "</td></tr>"+ "<tr><td>" +

"SAP P# (employee #)" + "</td>" +

"<td>" + "<input type=\"text\" sappn=\"expression\" value=\"" +

sappn + "\">" + "</td></tr><tr><td>" +

"FSI E-mail Address" + "</td>" +

"<td>" + "<input type=\"text\" email=\"expression\" value=\"" +

email + "\">" + "</td></tr><tr><td>" +

"Center/Location" + "</td>" +

"<td>" + "<input type=\"text\" center=\"expression\" value=\"" +

center + "\">" + "</td></tr><tr><td>" +

"Immediate Supervisor" + "</td>" +

"<td>" + "<input type=\"text\" isuper=\"expression\" value=\"" +

isuper + "\">" + "</td></tr><tr><td>" +

"Phone Number" + "</td>" +

"<td>" + "<input type=\"text\" phno=\"expression\" value=\"" +

phno + "\">" + "</td></tr>" + "<tr><td></td><td>" +

"<input type=\"submit\" value=\"" + "Display" + "\">" +

"</td></tr>" + "</table>" + "</form>");

break;

case WELCOME_STATE:

if (fname != null)

// create a uri for the event

uri = request.createPortalComponentURI();

uri.setPortalRequestEvent(request.createRequestEvent("back"));

response.write("<form action=\"" + uri.toString() +

"\" method=\"post\">" + "<table>" + "<tr><td>" + "First Name " + fname + "</td></tr>" +

"<tr><td>" + "Last Name " + lname + "</td></tr>" +

"<tr><td>" +

"<input type=\"submit\" value=\"" + "Go back" + "\">" +

"</td></tr>" + "</table>" + "</form>");

break;

default:

//should never happen

}

;

}

public void doCompute(IPortalComponentRequest request, IPortalRequestEvent event) {

System.out.println("doCompute");

try {

fname = event.getData().getAttribute("expression");

state = WELCOME_STATE;

} catch (NullPointerException npe) {

}

}

public void doBack(IPortalComponentRequest request, IPortalRequestEvent event) {

System.out.println("doBack");

fname = "";

state = INITIAL_STATE;

}

}

Thanks in Advance

TT

_________________

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2004 at 08:40 PM

    Hi,

    Did the html display?

    In addition, You should use the out.println() method instead of System.out.println().

    Regards, Ludovic

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2004 at 12:54 PM

    Hi "TT",

    just a general advise for submitting issues: If something does not work, try to minimize your example. No more characters than needed. And be precise about your problem, report what you would expect and what in fact happens. As precise as possible.

    Following this, you will get double attraction!

    Best regards

    Detlev

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.