Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to populate the fields of JSP with the Searched Record

 
Tushar Gosalia
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm building a project using Struts2 framework, and I'm stuck in a place where I trying to search the record from database, and want that searched record to get populated in the jsp textfield.
http://tinypic.com/view.php?pic=2pqlyu1&s=8#.U49udHI2Lw8. In this image as user enters the primary key and clicks the search button, the desired record should get displayed. Please tell me how should I achieve this.
I'm successfully able to retrieve the record from database using Action Class, but don't know how to transfer that record back to the JSP.
 
Joe Ess
Bartender
Pie
Posts: 9258
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is reloading the page OK? If so, you'd just populate your action with values for the fields (or a bean for the values) from the database and return a value (usually "success") that corresponds to the action in struts.xml.
If you don't want to reload the page, you would need AJAX to accomplish the same.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic