Sunday 5 February 2012

A SIMPLE DEMO FOR LOOKUP DISPATCH ACTION...HINTS

         In struts, there are five special  Actions.They are




                   1.ForwardAction


                   2.DispathAction


                   3.LookupDispathAction


                   4.SwitchAction


                   5.IncludeAction                   


          In these Actions first three actions (ForwardAction,DispatchAction,       LookupDispatchAction) are very important. 


I have already done  a     simple demo for DispatchAction which is about If we want to use   more than one function in Action class what we have to do. 


         LookupDispathchAction is also similar  to DispatchAction. 


       But,       Additionally we have to do  two things


                   1.Implemetation of getKeyMethodMap()  method
                   2.put entry in .properties file


  demoAction.java
 -----------------     
  public class demoAction extends LookupDispatchAction
       { 
        
//your methods


 protected   Map   getKeyMethodMap()
    {


    Map map=new  HashMap();
    map.put("operation.add","add");
    map.put("operation.sub","sub");


   //map your methods as above






    return map;
    }


  }


Application.properties file entry
----------------------------------
operation.add=Add
operation.sub=Sub
...