• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call Action method from another Action Class

 
Saritha Penumudi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic