This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to bind data to a textbox in servlet?

 
Soumya Rout
Ranch Hand
Posts: 49
Java Java ME Netbeans IDE
  • 0
  • 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
 
Karamjeet singh
Ranch Hand
Posts: 52
Flex jQuery Netbeans IDE
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that can be done.
thank you dude.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • 0
  • 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,
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • 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
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic