Struts Actions
Forward Action :
In Struts MVC model, you have to go through the Action Controller to get a new view page. In some cases, you really just need to get a specified JSP page only, it's so stupid to create an action controller class which just forward the pate to you.
ForwardAction acts as bridge from the current view and pages it link to.ForwardAction uses the RequestDispatcher to forward to a specified web resource.This allow you to link to an action instead of directly to a jsp.
Used of Forward Action :-
- The ForwardAction class is useful when you’re trying to integrate Struts into an existing application that uses Servlets to perform business logic functions.
- ForwardAction used to forward a request to another resource in your application, such as a Servlet that already does business logic processing or even another JSP page.
Include Action :
Include Action is similar the Forward Action but only difference is that you need to use the Include Action only if the action is going to be included by another jsp.
Used of Include Action :-
- IncludeAction class to include another resource in the response to the request being processed.
- IncludeAction class is useful when you want to integrate Struts into an application. Configure IncludeAction into struts-config.xml. We should be configure IncludeAction into struts-config.xml. You must create an action mapping when you want used IncludeAction The parameter attribute specifies the URL that will be included when the specified path is accessed.
Dispatch Action :
Struts DispatchAction class is used to group similar functionality into a single action, and execute the function depends on the given parameter value.
The DispatchAction class is used to group related action into one class.DispatchAction class is an abstract class.
This class extends the Action class.
You have a method for each logical action. The value of the the incoming request parameter is the name of the method.
Used of Dispatch Action :-
Using DispatchAction class, you can write multiple actions in into one Action class and removes the creation of multiple action classes. This class does not provide an implementation for the execute() method. The DispatchAction uses the execute method to manage delegating the request to the individual methods based on the incoming request parameter “method“
Mapping Dispatch Action :
Struts MappingDispatchAction class is used to group similar functionality into a single action class, and execute the function depends on parameter attribute of the corresponding ActionMapping.
Using MappingDispatchAction class, you can write multiple related functions in into one Action class and removes the creation of multiple action classes. But unlike DispatchAction, you have to write different various handlers for each function in struts-config.xml.
Some Important links :
http://www.javabeat.net/introduction-to-struts-actions/
Some Important links :
http://www.javabeat.net/introduction-to-struts-actions/
Comments
Post a Comment