Different Types of Action Classes / Built in Action Classes

Different types of Action classes / Built in Action classes: –

  • SwitchAction
  • Forwordaction
  • Local Action
  • Include Action
  • Dispatch Action
  • Lookup Dispatch Action
  • Mapping Dispatch Action
  • Download Action
  • These classes are available in org.apache.Struts.Action package.
  • This package is available in Struts-home\lib\Stuts-extras-1.3.8.jar file.
  • Foll all these action classes the derect / indirect super class is org.apache.Struts.action.Action class.

 Different types of Action classes


<a href = “B.jsp”> go </a>

  • A.jsp is directly comm. with B.jsp. so we can say the diagram is violating MVC2 principle which says the two jsps of view layer must communicate each other through controller servlet.

Solution (1):-

Different types of Action classes Built in Action Classes


<a href = “xyz.do”> go </a>


    <action path = “/xyz” type = “xyzAction”>

         <forward name = “ok” path = “IB.jsp”/>


  • This diagram satisfies MVC2 principles towards hyperlink based communication b/w A.jsp and B.jsp that means A.jsp is communicating with B.jsp through the controller servlet called ActionServlet. But taking one separate Action class having only mapping.findForword () call in execute method to satisfy the requirement is meaningless and not recommended aperation.

Sulution (2):- (with forward action) 

  • In this diagram A.jsp is comm… With B.jsp through controller servlet. So we can say MVC2 principle is not violated more ever it is not taking support of any dummy action class to full fill the requirement.

With respect to diagram (1):-

1)      Enduser click on the go hyperlink of A.jsp

2)      Based on bref url the request url will be generated.

3)      ActionServlet traps & takes the request

4)      ActionServlet uses Struts-configuration file to get the TargetAction class

5)      ActionServlet finds forwardAction class as the Target Action class to execute based on the Acti action path “/xyz”

6)      The predefined execute (-,-) method of predefined forward Action class uses the parameter attribute value B.jsp and returns ActionForward object to ActionServlet pointing to B.jsp

7)      ActionServlet forwards the control to B.jsp

  • While working with all built-in Actionclasses including ForwordAction we must add Struts-home\lib\ Struts-extracts-1.3.8.jar file to WEB-INF\lib folder of your Struts application.
  • In MVC2 Arh. Based applications all the operations in the web application execution must take place under the control of controller servlet for better monitoring controller on the application execution.

Leave a Reply

Your email address will not be published. Required fields are marked *