In my Struts Action, I get a returned List from a DB call.
In the action path entry in struts-config.xml, I have a "forward name = " entry for the JSP that I want to go to to display the actual data.
My question is how do I set the "result" (List) into the session, (appropriate) form bean, etc., so the target JSP can access and then display the data? Currently, the target JSP (in the "forward name=") comes up, but there is no data.
I tried using the form bean from the first page (where the user selects the value that will be used for the DB call), but that didn't work.
Thanks in advance for help with this newbie question.
One thing with Struts that can be a little confusing (and might be seen as a limitation) is that your action has just one form. That is often not a problem and you can configure the action that displays a page to use the same form as the action that processes the page's submission. In this case it is straight forward to populate data on the form in your display action.
In some cases the two actions deal with different forms. You could just stick values directly on the request, but I try to pass data using forms. In this case you just need to instantiate an instance of your form class, populate it with data, and then save the form as an attribute on the request. The name that you use just needs to match up with the "name" attribute of the process action (the action you specify in the html:form tag).
You can try using the second Action Form, populate them in the action. You need to put the Action Form in request / session scope. Then forward the request from the Action to the jsp which has the Action Form. When displaying the Forwarded jsp, it will check whether the Action Form exists in scope, if it does it will populate else will display default values.