The keys in your KeyMethodMap should correspond to messages in your message bundle used to render the button. So you would have in your jsp: <html:submit> <bean:message key="button.add.banana"/> </html:submit>
in your action: protected Map getKeyMethodMap(ActionMapping mapping, ActionForm form, HttpServletRequest request) { Map map = new HashMap(); map.put("button.add.banana", "addBanana"); map.put("button.delete.banana", "deleteBanana"); return map; } And in your message-resources file: button.add.banana=Add Banana button.delete.banana=Delete Banana If you don't need the message resources (for i18n or something), you might want to use DispatchAction instead. -Rob -----Original Message----- From: JONATHAN PHILIP HOLLOWAY [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 12, 2003 12:04 PM To: Struts Users Mailing List Subject: LookupDispatchAction Does anybody know why the following is casuing me so many problems. I'm using LookupDispatchAction and have a number of methods defined in my action class including an execute method. The problem is that the execute method ALWAYS gets executed and not the intended method. I have in the addbanana.jsp: <html:submit value="Add Banana" property="action"/> and in Struts-config: <action path="/addbanana" type="com.example.AddBananaAction" name="BananaForm" input="/addbanana.jsp" scope="session" parameter="action"> </action> In my action class I've defined the following: public ActionForward addBanana(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return (mapping.findForward("success")); } public ActionForward deleteBanana(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return (mapping.findForward("success")); } /** * Get key method map just obtains the map that maps the button * text onto the particular method in this action * @param mapping is the action mapping * @param form is the action form * @param request is the http request */ protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("Add Banana", "addBanana"); map.put("Delete Banana", "deleteBanana"); return map; } /** * Execute method * @param mapping is the information regardin gthe URI mapping and the action * @param form is the action form used * @param request is the request * @param response is the response * @return the action forward, a destination to forward the user onto (eg another JSP) */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { Logger.logInfo("Execute Called"); //We can now put these bits in the database return (mapping.findForward("success") } Does anybody know why EXECUTE is called but the intended ADDBANANA method is not called? Many thanks, Jon. *---------------------------------------------* Jonathan Holloway, Dept. Of Computer Science, Aberystwyth University, Ceredigion, West Wales, SY23 3DV. 07968 902140 http://users.aber.ac.uk/jph8 *---------------------------------------------* --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]