Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

retrieving data from jsp's to jspDynPage and eventhandling

Hi everyBody,

I made a portal application with a JSPDynpage and 2 jsp pages.

Now What I would like to know is:

first of al I have inputfields on my jsp page.

How can I access the data provided by the user in my DynPage.

and is it possible to have a JspDynpage For every jsp page I have so that every DynPage contains the Eventhandlers for a certain jsp page.

Because right now I have to put all the eventhandlers of the 2 jsp pages into 1 jspDynPage.

EDIT:

I allready found how to make an other JspDynPage handle the events.

Now just how to get info from the inputFields...

Thanks

Greetings

Wouter

Message was edited by:

Wouter Delellio

Former Member
Former Member replied

Bean

package bean;

/*

  • A very simple bean whose only purpose is to store a simple String.

  • It as a get and set method to store and recall the string.

*/

public class DynPageNameBean

{

public String name;

public String getName ()

{

return name;

}

public void setName (String name)

{

this.name = name;

}

}

l Adding an inputField "user_name_input" - the JSP DynPage retrieves the data in the input field using getComponentByName.

<hbj:label

id="label_input"

text="Your name please"

design="LABEL"

required="TRUE"

labelFor="user_name_input"

/>

<%-- inputfield to allow userinput - the inputfield has the id "user_name_input" which is --%>

<%-- used in the JSP DynPage to access the input field and retrieve the input of the user --%>

<hbj:inputField

id="user_name_input"

type="STRING"

design="STANDARD"

width="250"

maxlength="30"

/>

l in doProcessAfterInput (method is called whenever an event occurs) we request the inputField "user_name_input" from the JSP by using

getComponentByName to have access to the user input in the JSP DynPage. If the inputField "user_name_input" is not empty the string is

stored in the bean.

*/

public DynPageOne() {

this.setTitle("Become a Jedi");

}

/**

  • Used for handling the input. Generally called on each event

  • we use this method to get the user name and store it in the bean

*/

public void doProcessAfterInput() throws PageException

{

// get the input field from the JSP

InputField myInputField = (InputField) getComponentByName("user_name_input");

if (myInputField != null) {

this.name = myInputField.getValueAsDataType().toString();

}

IPortalComponentRequest request

= (IPortalComponentRequest) this.getRequest();

IPortalComponentContext myContext = request.getComponentContext();

IPortalComponentProfile myProfile = myContext.getProfile();

DynPageNameBean myNameContainer

= (DynPageNameBean) myProfile.getValue("MyNameBean");

myNameContainer.setName(name);

}

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question