• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to bind data to a textbox in servlet?  RSS feed

 
Ranch Hand
Posts: 49
Java Java ME Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 52
Flex jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Soumya Rout
Ranch Hand
Posts: 49
Java Java ME Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that, But how to assign that value to a textfield of that jsp page.
 
Karamjeet singh
Ranch Hand
Posts: 52
Flex jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 52
Flex jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should put this like
<input type="text" value="<%=request.getAttribute("stringvalue")%>"/>
 
Soumya Rout
Ranch Hand
Posts: 49
Java Java ME Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that can be done.
thank you dude.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be better to use JSTL rather than JSP scriptlets. With JSTL you can write the same line as:
No scriptlet.

Best Regards,
 
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Gregg Bolinger wrote:That's not JSTL. That's the Express Language (EL).



Uhhh, right :embarrassed: - sorry.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!