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 Call Action method from another Action Class 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 "Call Action method from another Action Class" Watch "Call Action method from another Action Class" New topic
Author

Call Action method from another Action Class

Saritha Penumudi
Ranch Hand

Joined: Aug 18, 2003
Posts: 147
Hi,
I am using DispatchAction for all my JSP forms.

Now, I have a scenario where I have to show same screen from n different places. That screen need some data that I have to get before I render UI on to the browser. Hence I have a setup method in the class that would go and get the data, hold that data in request scope and return ActionForward() to that Jsp page.

Now from all other screens I have to call this setup method. How can I forward request from one action to other?

Do this code make any sense.

public void performSomething(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response){
Action1 ac1 = new Action1();
ac1.setup(mapping,form,request,response); // will this work?

}

How such situations will be handled?

Thank you
Saritha
[ September 17, 2004: Message edited by: Saritha ventrapragada ]
Matt Sloan
Greenhorn

Joined: Aug 27, 2004
Posts: 26
what not put a forward tag to this new action that you want to call? To me that makes more sense.
Saritha Penumudi
Ranch Hand

Joined: Aug 18, 2003
Posts: 147
Thanks Matt,

I guess that is the best solution to handle that situation. By this we will not relay on Action class but on framework.

Thank you
Saritha
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Call Action method from another Action Class
 
Similar Threads
html:image - running into an infinite loop
Communication between Actions classes
How to forward to Action class
Setting value of java variable to hidden field
How To Handle Setting Up Pages Being Forwarded To