I am trying to use org.apache.struts.actions.LookupDispatchAction class to
dispatch my actions.
I can dispatch actions from buttons nicely, but I do not know how to
dispatch actions from links.
No matter what I try, I always get:
"HTTP ERROR: 500 Request[/details] does not contain handler parameter named
action"
I have tried to use paramId-parameter to attach request parameter to the
link-element,
but I haven't figured out how to do it correctly.
Is it possible to use LookupDispatchAction to dispatsh actions from links at
all?
If not, what would be proper way to implement similar functionality?
Should I discard whole LookupDispatchAction and use something else instead
of that,
or just handle links differently?
By the way I am trying to avoid javascript and scriptlets at all costs.
Thanks
In JSP-file I have:
<html>
<body>
<html:form action="details.do">
<html:link action="details">link</html:link>
<html:submit property="action"><bean:message
key="button.save"/></html:submit>
<html:submit property="action"><bean:message
key="button.create"/></html:submit>
</html:form>
</body>
</html>
In struts-config.xml I have action mapping:
<action name="EmpDetailsForm"
path="/details"
type="strutstest.EmpDetailsAction"
input="empList.jsp"
scope="request"
validate="false"
parameter="action">
<forward name="success" path="/empList.jsp"/>
<forward name="failure" path="/empList.jsp"/>
</action>
My EmpDetailsAction class is derived from LookupDispatchAction:
public class EmpDetailsAction extends LookupDispatchAction {
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.save", "save");
map.put("button.create", "create");
return map;
}
public ActionForward save(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
servlet.log("EmpDetailsAction.save");
return (mapping.findForward("success"));
}
public ActionForward create(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
servlet.log("EmpDetailsAction.create");
return (mapping.findForward("success"));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]