This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating ActionForm
 
Similar Threads
how to formard a JSP to other JSP
problem with registration page
Struts + I18N
Managing URLs and bookmarks in Struts
struts2 validation result input cannot be an action?