This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Newbie: Struts 1 -> Passing from one struts action to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Newbie: Struts 1 -> Passing from one struts action to another" Watch "Newbie: Struts 1 -> Passing from one struts action to another" New topic
Author

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

Anup Bansal
Ranch Hand

Joined: Sep 12, 2006
Posts: 69
Hi,

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

<action path="/actions/firstAction"
type="example.SecurityAction"
scope="request">
<forward name="success"
path="/actions/secondAction.do"/>
<forward name="failure"
path="/pages/login.jsp"/>
</action>

<action path="/actions/secondAction"
type="example.BusinessAction"
scope="request">
<forward name="success" page="/pages/businessPage.jsp"/>
</action>

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Newbie: Struts 1 -> Passing from one struts action to another
 
Similar Threads
problem in getting data from request
Filters and web.xml problem + Eclipse
Can I have two Action for one Form
2 actions, same form class different instance?
Bean setters not called after forward, if enctype multipart/form-data is used in JSP