Can we call an Action from another Action in struts???

V

vyshu

hi,
Let me explain my situation.
I have a form for updating the customer details.when ever the user
say submit,it calls the action and performs the updation.Now comes my
problem,I want to redirect back to the same update page with the newly
updated values.I think you got what i meant.
Let me be specific,Can i call an action from another action?.

somthing like
new ActionForward("something");
this should call another form bean and Action.

If it is possible please do let me know.
waiting for your suggestions.
thanks,
vysh.
 
R

Richard Senior

vyshu said:
Let me be specific,Can i call an action from another action?.

somthing like
new ActionForward("something");
this should call another form bean and Action.

You can define a forward in the Struts config file that refers to an
action, e.g.

<forward name="something" path="/Something.do"/>

...

<action path="/Something" ... />

Then your action can do this:

return mapping.findForward("something");

You need to establish a strategy for organising actions around pages,
otherwise you will get yourself in a knot. For example, do you have an
action that populates the request with the required data for the view
(i.e. the JSP), forward to that view, then have another action that
processes the submit? Or do you combine the two actions into one, using
parameter derived from the form button to choose your course through a
single action.

Have a look at this, particularly the sections starting at "Two actions,
one form":

http://www.theserverside.com/tt/articles/article.tss?l=StrutsActionMapping

Also, try some searches on "action chaining", e.g.

http://husted.com/poe/17 Oct 2005.html
http://www.javaworld.com/javaworld/jw-09-2004/jw-0913-struts.html?page=4
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top