I have an action class MyAction extends LookupDispatchAction, there are several buttons and a link in
JSP page,
delete, add, update, display etc. actions.
My struts-config.xml:
<action
path="/doSomething"
type="MyAction"
name="myForm"
scope="request"
validate="true"
input="/myAction.jsp"
parameter="methodd">
</action>
In MyAction class:
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.insert", "insert");
map.put("button.delete", "delete");
map.put("link.showLink", "showLink");
return map;
}
public ActionForward insert(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
System.out.println("do something for insertion");
...........
}
public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
System.out.println("do something for deletion");
...........
}
public ActionForward showLink(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
System.out.println("do something for displaying");
...........
}
In my JSP:
<html:submit property="methodd">
<bean:message key="button.insert"/>
</html:submit>
<html:submit property="methodd">
<bean:message key="button.delete"/>
</html:submit>
There is a link, when click it, it will do some action (call the showLink() method in MyAction class ) as well.
<a href="doSomething.do?methodd=showLink">
<bean:message key="link.showLink"/>
</a>,
But, it Can NOT work properly when click the link.
Error msg is : Request[/doSomething] does not contain handler parameter named methodd
But, if i use a Button instead of the link, everything works fine
<html:submit property="methodd">
<bean:message key="link.showLink"/>
</html:submit>
However, I have to use a link to perform this action.
I check the syntax of the link (<a href) in jsp, it should be OK.
Anybody can help me? Any suggesions of how to use a link instead of using a button in LookupDispatchAction?
I am going to be dead, :--((
Thanks a million,
Sunflower