You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rajesh M Vasudevan <ra...@neosoftsolutions.com> on 2003/09/29 04:23:12 UTC

Re: [SOLVED] Problem with LookupDispatchAction

Hi all,

The framework seems to look for the default "execute" method in the action
class.  If it finds one, it doesn't bother for a lookup of any other action
mapping.  So, I removed the execute method.. and the mapping is very much in
place.

Thanks
Rajesh

> Hi all,
>
> Eventhough I didnt miss it in my actual implementation, I missed to put
the
> property="action" in the jsp tag.  Still the mechanism doesnt seem to work
> :-(
> So, the updated JSP would be
> <nested:submit property="action" ><bean:message
> key="button.Store"/></nested:submit>
>
> Any feedbacks?
> -Rajesh
> > 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: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org