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 / November 2005

Tip: Looking for answers? Try searching our database.

connecting two struts actions

Thread view: 
raavi - 22 Nov 2005 06:59 GMT
Hi
   i am now engaged in software development involving struts
framework.now i want to display some results processed in the first
action and then forward to second action.where the same processing is
carried out  and the result is to be displayed in the form of  a
string.how is this possible? i have used RequestDispatcher object,but
the program is still not working .pls do hepl me
Markus - 22 Nov 2005 11:35 GMT
Try this:
In struts-config.xml define an forward for the first action named
success which points to the second action.
If you return arg0.findForward("success") (arg0 = ActionMapping) your
Request will be forwarded to the next Action.

Example:

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

//Forwards the Request to the Action defined in struts-config.xml under
TestAction.
public class TestAction extends Action {

    public ActionForward execute(
        ActionMapping arg0,
        ActionForm arg1,
        HttpServletRequest arg2,
        HttpServletResponse arg3)
        throws IOException, ServletException {

        return arg0.findForward("success");
    }
}


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



©2009 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.