struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jussi Koiranen" <jussi.koira...@solita.fi>
Subject Dispatching actions from html:link-elements with LookupDispatchAction
Date Thu, 10 Jul 2003 10:10:54 GMT
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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message