• Post Reply Bookmark Topic Watch Topic
  • New Topic

Newbie: Struts 1 -> Passing from one struts action to another  RSS feed

Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have two questions w.r.t struts. Following is an example of my action mapping:

<action path="/actions/firstAction"
<forward name="success"
<forward name="failure"

<action path="/actions/secondAction"
<forward name="success" page="/pages/businessPage.jsp"/>

1. How can i pass objects from one action class to another? Say from FirstAction to SecondAction
Can i use request.setattribute in the first action class to set the object and get in the second action using request.getattribute, which i can then set in the form of the seconAction?
If i define a third action class, will the object set in the first action also be accessible in the third action class (without me setting it again explicitly in the second action class)?
Are there any implications of using request.setattribute?

2. Is it better to set the object in some database on form submission in the first action class and then retrieve it in the second action class from the database, set it in the form bean for display in the jsp?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!