Posts

Showing posts with the label Struts

STRUTS ACTION - AGGREGATING ACTIONS IN STRUTS

If you are a Struts developer then you might have experienced the pain of writing huge number of Action classes for your project. The latest version of struts provides classes using which you can aggregate a related set of actions into a single unified action. In this article we will see how to achieve this. Struts provides four important classes for this purpose. These classes are called as Dispatchers. The important Dispatchers that struts provides includes :   DispatchAction ,   ActionDispatcher   ,   LookupDispatchAction   and MappingDispatchAction . All these classes can be found in the package   org.apache.struts.actions . Let us look in to each of these in detail. Our examples use the simple CRUD actions. DispatchAction:   In this type of aggregation, the action class must extend DispatchAction class as shown. public final class CRUDDispatchAction extends DispatchAction { public ActionForward create(ActionMapping mapping, ActionFo...

Struts MappingDispatchAction Example

Image
Struts MappingDispatch Action   (org.apache.struts.actions.MappingDispatchAction) is one of the Built-in Actions provided along with the struts framework. The   org.apache.struts.actions.MappingDispatchAction   class is a subclass of org.apache.struts.actions.DispatchAction   class. This class enables a user to collect related functions into a single action class. It  needs to create multiple independent actions for each function. Here in this example you will learn more about Struts MappingDispatchAction that will help you to grasp the concept better. Let's develop a class    MappingDispatch_Action   which is a sub class of  org.apache.struts.actions.MappingDispatchAction   class. This class does not provide an implementation for the   execute()   method because  DispatchAction   class itself implements this method.    MappingDispatchAction  class is much like the DispatchAction class ex...

Struts LookupDispatchAction Example

Image
Struts LookupDispatch Action   (org.apache.struts.actions.LookupDispatchAction) is one of the Built-in Actions provided along with the struts framework. .The   org.apache.struts.actions.LookupDispatchAction   class.is a subclass of org.apache.struts.actions.DispatchAction   class.This class enables a user to collect related functions into a single action class. It eliminates the need of  creating multiple independent actions for each function. Here in this example you will learn more about Struts LookupDispatchAction that will help you to grasp the concept better. Let's develop a class    LookupDispatch_Action   which is a sub class of  org.apache.struts.actions.LookupDispatchAction   class. This class does not provide an implementation for the   execute()   method because  DispatchAction   class itself implements this method.    LookupDispatchAction  class is much like the DispatchAction...