Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
vyshu - 27 Apr 2007 05:13 GMT
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.
Richard Senior - 27 Apr 2007 10:19 GMT
> 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%20Oct%202005.html
http://www.javaworld.com/javaworld/jw-09-2004/jw-0913-struts.html?page=4

Signature

Regards,

Richard



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.