The key method map should contain resource keys not actual message text.

David



From: "JONATHAN PHILIP HOLLOWAY" <[EMAIL PROTECTED]>
Reply-To: "JONATHAN PHILIP HOLLOWAY" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: LookupDispatchAction
Date: Wed, 12 Feb 2003 17:03:57 -0000

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
*---------------------------------------------*

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


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

Reply via email to