Hi,
I was following the link
http://jakarta.apache.org/struts/api/org/apache/struts/actions/LookupDispatc
hAction.html
to implement multiple submit buttons mapped to the same Action Bean.  I
couldnt achieve the same.  Here is a step by step account of what I did:
1.struts-config.xml
     <action scope="session" validate="true" name="adminForm"
path="/Admin/SaveAdmin" type="org.admin.SaveAdminAction" parameter="action">
  <forward name="success" path="/pages/org/admin/saveadmin.jsp" />
  <forward name="emp_list" path="/pages/org/orgadmin/emp_list.jsp" />
  </action>
2.JSP
<nested:submit><bean:message key="button.Store"/></nested:submit>
<nested:submit><bean:message key="button.Delete"/></nested:submit>
3. ApplicationResources.properties defined
        button.Store   = Store
        button.Delete   = Delete
4.Action Class:
Extended the class from LookupDispachAction
    -----public class SaveAdminAction extends LookupDispatchAction------
Added the following methods
 protected Map getKeyMethodMap() {
    System.out.println("\n\nHello getKeyMethodMap\n\n");
    Map map = new HashMap();
    map.put("button.Store", "Store");
    map.put("button.Delete", "Delete");
    return map;
   }

 public ActionForward Store(ActionMapping mapping,
          ActionForm form,
          HttpServletRequest request,
          HttpServletResponse response)
          throws IOException, ServletException
    {

      System.out.println("\nSTORE\n");
      return mapping.findForward("success");
   }

 public ActionForward Delete(ActionMapping mapping,
          ActionForm form,
          HttpServletRequest request,
          HttpServletResponse response)
          throws IOException, ServletException
    {

      System.out.println("\nDELETE\n");
      return mapping.findForward("success");
   }

After doing all this, I noticed that getKeyMethodMap() is not getting
invoked.  When the action class is fired, it still goes to the execute
method.. It does not do a lookup in the getKeyMethodMap() or invoke the
corresponding mapped methods.  What am I doing wrong!.  Please advise.

Thanks
Rajesh



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to