cancel
Showing results for 
Search instead for 
Did you mean: 

examples about get inputfield value in htmlb in jsp ?

Former Member
0 Kudos

Hi all:

I have one small jsp application, using htmlb.

I would like to get the htmlb inputfield value in jsp, how can I fetch it ?

Thanks a lot.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi sir

I have tried to use request.getParameter with id, but failed.

the id will change in html source code of my htmlb-jsp page

Former Member
0 Kudos

Hello Jianhong,

please try following code:


...
import com.sapportals.htmlb.rendering.PageContextFactory
...
	IPageContext context = PageContextFactory.createPageContext(request, response);
	String my_value = ((InputField) context.getComponentForId("Your component ID as you enter it in id attribute of a field")).getValue().toString()
... and so on

hope it helps.

regards.

mz

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks a lot.

is there some examples about how can i call context, use table model in htmlb ?

I wish there is some examples like webdynpro for java

Really thanks

Former Member
0 Kudos

Hello Jianhong,

please refer to the following link https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/112df959-0d01-0010-b198-f93b0... [original link is broken] [original link is broken], which contains three business packages for Enterprise Portal with a lot of tutorials and examples related to HTMLB and Portal Content Development.

regards,

mz

Former Member
0 Kudos

hi

sir. I mean

After I define one htmlb tag - form, and one inputfield

after I click on submit button, how can I fetch the value inside that inputfield

prashil
Advisor
Advisor
0 Kudos

Hi,

Once you submit the form, you can retrieve the value of InputField as:

String name = request.getParameter("in_name");

where in_name is the name/id which you have given to your InputField.

Morever, you can set the your bean value as the text entered in the InputField, and later retrieve the value from the bean.

Regards,

Prashil

Former Member
0 Kudos

Hi

I hope ur application has Java file, Bean file and JSP file. Bean file is used to set and get values for ur variables.

> Set the value for ur Inputfield in Bean using setter method.

> Create a object for ur bean class and fetch the vallue.

For example

<hbj:inputField id="name" type="string" value="<b><%=myBean.getName()%></b>"/>

Here, myBean is the object for the bean file.

Regards

Nithya