aspose file tools*
The moose likes Struts and the fly likes How to populate the fields of JSP with the Searched Record Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to populate the fields of JSP with the Searched Record" Watch "How to populate the fields of JSP with the Searched Record" New topic
Author

How to populate the fields of JSP with the Searched Record

Tushar Gosalia
Greenhorn

Joined: Feb 19, 2013
Posts: 27
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

Joined: Oct 29, 2001
Posts: 8997
    
    9

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.


[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to populate the fields of JSP with the Searched Record