Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Struts Struts Action Chaining
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Clark
Struts Action Chaining
1 Answer(s)      4 years and 2 months ago
Posted in : Struts


Struts Action Chaining?


Advertisement
View Answers

November 20, 2010 at 3:23 PM


The struts-config.xml file is used for action mapping. The action tag has a forward entries. Chaining actions can be done by simply using the proper mapping in your forward entries.

 public class FirstAction extends Action
    {
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {
    // Developer Logic
    return mapping.findForward("success");
    }
    }

    /* com/SecondAction.java */
    ...

    public class SecondAction extends Action
    {
    public ActionForward execute(ActionMapping mapping, 
ActionForm form, HttpServletRequest request, 
HttpServletResponse response) throws]

    Exception
    {
    // Another Logic

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

    For chaining action of these two action the code of action in struts-config.xml file.

    <action-mappings type="org.apache.struts.action.ActionMapping">
    <action path="/First"
    type="com.FirstAction"
    validate="false">
    <forward name="success" path="/Second.do" />
    </action>
    <action path="/Second"
    type="com.SecondAction"
    scope="session"
    validate="false">
    <forward name="success" path="/Output.jsp" />
    </action>
    </action-mappings>

Thanks.



Related Tutorials/Questions & Answers:
Struts Action Chaining
Struts Action Chaining  Struts Action Chaining
no action mapped for action - Struts
no action mapped for action  Hi, I am new to struts. I followed...: There is no Action mapped for action name HelloWorld
Advertisements
Struts dispatch action - Struts
Struts dispatch action  i am using dispatch action. i send the parameter="addUserAction" as querystring.ex: at this time it working fine. but now my problem is i want to send another value as querystring for example
Action Configuration - Struts
Action Configuration  I need a code for struts action configuration in XML
Struts Action Class
Struts Action Class  What happens if we do not write execute() in Action class
Struts Action Classes
Struts Action Classes  1) Is necessary to create an ActionForm to LookupDispatchAction. If not the program will not executed. 2) What is the beauty of Mapping Dispatch Action
action tag - Struts
action tag  Is possible to add parameters to a struts 2 action tag? And how can I get them in an Action Class. I mean: xx.jsp Thank you
Login Action Class - Struts
Login Action Class  Hi Any one can you please give me example of Struts How Login Action Class Communicate with i-batis
servlet action not available - Struts
servlet action not available  hi i am new to struts and i am.... Struts Blank Application action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml 2 action *.do
Action classes in struts
Action classes in struts  how many type action classes are there in struts   Hi Friend, There are 8 types of Action classes: 1.ForwardAction class 2.DispatchAction class 3.IncludeAction class 4.LookUpDispatchAction
Servlet chaining
Servlet chaining  What is Servlet chaining
action Servlet - Struts
action Servlet  What is the difference between ActionServlet ans normal servlet? And why actionServlet is required
DTO & Action class - Struts
DTO & Action class  Hi I am really new to struts2. I just wanted to know that if I have a DTO and an action class, how do I put the form data into the DTO? Can someone please explain with a simple example
Dispatch Action - Struts
Dispatch Action  While I am working with Structs Dispatch Action . I am getting the following error. Request does not contain handler parameter named 'function'. This may be caused by whitespace in the label text
autocall for sturts action class - Struts
autocall for sturts action class  Hi All, We are developing a web application with struts frame work. In this project I have to call an action... in the server on action class should run automatically. how can I do this. help me
Struts 2 action-validation.xml not loading
Struts 2 action-validation.xml not loading  Hi All, I am getting... error SERVER : Caught exception while loading file package/action-validation.xml Connection refused: Connect - (unknown location) The path of my action
Struts 2 Action Tag
Struts 2 Action Tag "action" Tag in Struts 2 is used by developer to call... action name. Struts 2 Action Tag is one of the Data Tags, which are used.... Following example will further explain the complete use of Struts 2 Action
Calling Action on form load - Struts
Calling Action on form load  Hi all, is it possible to call... this list is coming from the action which i m calling before the page is being... to direct user directly to this page i m calling an action which is preparing a list
jsp to struts 2 action conversion problem - Struts
jsp to struts 2 action conversion problem  i have one jsp page that includes 3 other jsp pages(using RequestDispactcher).how to convert that jsp page to a struts2 action?among that one jsp page is wrritten using jpivot,wct tags
Is Multiple Actions in Action class - Struts
Is Multiple Actions in Action class  In ActionClass we can use only one action i.e execute(), but in DispatchAction we can use multiple actions.My question is , we can use multiple actions in Action class if(action.equals("add
Servlet action is currently unavailable - Struts
Servlet action is currently unavailable   Hi, i am getting the below error when i run the project so please anyone can help me.. HTTP Status 503 - Servlet action is currently unavailable
I have a doubt regarding action - Struts
I have a doubt regarding action   hi, I have doubt regarding struts,I got response through jsp and once again it redirecting to action..., Please check Action Mapping in the struts-config.xml. If you have any problem
Struts Dispatch Action Example
Struts Dispatch Action Example       Struts Dispatch Action... function. Here in this example you will learn more about Struts Dispatch Action
Understanding Struts Action Class
Understanding Struts Action Class       In this lesson I will show you how to use Struts Action... - if the application business logic throws an exception Adding the Action Mapping in the struts
Struts 2 Redirect Action
Struts 2 Redirect Action       In this section, you will get familiar with struts 2 Redirect action and learn to use it in the struts 2 application. Redirect After Post: This post
Struts(1.3) action code for file upload
Struts(1.3) action code for file upload  Hi All, I want to upload... application using HttpUrlConnection. How can i write my struts(1.3) action code... action or let me how the upload request is post to struts action. Thanks  
STRUTS ACTION - AGGREGATING ACTIONS IN STRUTS
STRUTS ACTION - AGGREGATING ACTIONS IN STRUTS... of Action classes for your project. The latest version of struts provides classes... action. In this article we will see how to achieve this. Struts provides four
object chaining? - Hibernate
object chaining?  daoobject.getsession().begainTransaction; can any one explain the code, i am not understanding this line when iam working with swt and hibernate
Forgot Password Action,Struts Forgot Password Action class
Forgot Password Action       Forgot Password Action The password forgot Action is invoked... password action requires user name and passwords same as you had entered during
what is object chaining? - Hibernate
what is object chaining?   daoobject.getsession().begainTransaction; can any one explain the code, i am understanding this line when iam working with swt and hibernate
STRUTS 2 Could not find action or result
STRUTS 2 Could not find action or result  hiii..i am new to struts 2...;package name="Basic" extends="struts-default"> <action name="fetch" class... on my log: WARNING: Could not find action or result There is no Action
 

 

 

DMCA.com