| Author |
How to bind data to a textbox in servlet?
|
Soumya Rout
Ranch Hand
Joined: Aug 06, 2009
Posts: 49
|
|
Hi,
I have three textfields in one jsp page. In runtime user will put 2 values in the two textfields and in third textfield data from database. I have retrieved from database using a servlet and request dispatches to the same page. But how to bind the data to textfield.
Please help me out.
Regards from
Soumyaranjan
|
 |
Karamjeet singh
Ranch Hand
Joined: Feb 24, 2010
Posts: 49
|
|
you can use this type by maintaing sessions between pages
by request.setattribute or by request.getattribute
bind value with setattribute
retrieve value where you want by getattribute
|
Don't aim for success if you want it; just do what you love and believe in, and it will come naturally.
|
 |
Soumya Rout
Ranch Hand
Joined: Aug 06, 2009
Posts: 49
|
|
I know that, But how to assign that value to a textfield of that jsp page.
|
 |
Karamjeet singh
Ranch Hand
Joined: Feb 24, 2010
Posts: 49
|
|
karamjeet singh wrote:you can use this type by maintaing sessions between pages
by request.setattribute or by request.getattribute
bind value with setattribute
retrieve value where you want by getattribute
sorry boss i don't understand your question please ignore previous post
for binding you can use this method
not sure for retrieval from database
|
 |
Karamjeet singh
Ranch Hand
Joined: Feb 24, 2010
Posts: 49
|
|
you should put this like
<input type="text" value="<%=request.getAttribute("stringvalue")%>"/>
|
 |
Soumya Rout
Ranch Hand
Joined: Aug 06, 2009
Posts: 49
|
|
Yes, that can be done.
thank you dude.
|
 |
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
|
|
It would be better to use JSTL rather than JSP scriptlets. With JSTL you can write the same line as:
No scriptlet.
Best Regards,
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Mark E Hansen wrote:It would be better to use JSTL rather than JSP scriptlets. With JSTL you can write the same line as:
No scriptlet.
Best Regards,
That's not JSTL. That's the Express Language (EL).
|
 |
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
|
|
Gregg Bolinger wrote:That's not JSTL. That's the Express Language (EL).
Uhhh, right :embarrassed: - sorry.
|
 |
 |
|
|
subject: How to bind data to a textbox in servlet?
|
|
|