File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Populating ActionForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Populating ActionForm" Watch "Populating ActionForm" New topic
Author

Populating ActionForm

Christian Spiteri
Greenhorn

Joined: Sep 29, 2003
Posts: 3
Hi there,
I'm new to struts so excuse me if this seems like a simple question.
I have a search page (linked to an ActionForm) which returns a jsp with the search results. All the search results have a link, which points to an Action class, passing the id of the search result as a parameter. So far so good.
When I click on any search result, the Action gets the data from the database, populates the ActionForm and forwards to the jsp. It seems that the jsp is not finding the ActionForm data, so the page remains empty. What am I doing wrong?
Cheers,
Kris.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Christian !
Have you sent the ActionForm back to the jsp via setAttribute() ? Like this :

request.setAttribute(mapping.getAttribute(), yourForm);
// Forward to the appropriate View
return (mapping.findForward(target));
I hope it helps...
Cheers !
F�bio
Christian Spiteri
Greenhorn

Joined: Sep 29, 2003
Posts: 3
Thanks for your help mate,
It worked fine.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
My pleasure
F�bio
 
Don't get me started about those stupid light bulbs.
 
subject: Populating ActionForm
 
Similar Threads
Managing URLs and bookmarks in Struts
struts2 validation result input cannot be an action?
how to formard a JSP to other JSP
problem with registration page
Struts + I18N