Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts Users »

RE: LookupDispatchAction problem

Yee, Richard K,,DMDCWEST

2004-02-10


Søren,
The error message indicates that you are missing a button.search entry in
your Application Resources file.

-Richard

-----Original Message-----
From: Søren Hjarlvig [mailto:shj@(protected)]
Sent: Tuesday, February 10, 2004 2:13 PM
To: struts-user@(protected)
Subject: LookupDispatchAction problem


I'm following Ted's tip (http://husted.com/struts/tips/003.html) but I
can't get to work:

With the newest nightly build I'm getting the following error:

500 Servlet Exception
javax.servlet.ServletException: Action[/administrator] missing resource
'button.search' in key method map
 at
org.apache.struts.actions.LookupDispatchAction.getLookupMapName(LookupDispat
chAction.java:283)
 at
org.apache.struts.actions.LookupDispatchAction.getMethodName(LookupDispatchA
ction.java:324)
 at
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.
java:201)
....

The form:
...
<html:form method="get" action="/administrator">
<html:submit property="myaction">button.search</html:submit>
...
</html:form>
...

The resulting request:
http://localhost:8080/fonde/administrator.do?myaction=button.search

struts-config.xml:
...
<action
path="/administrator"
type="fonde.webedit.AdministratorAction"
name="administratorForm"
scope="request"
input="/pages/administrator.jsp"
parameter="myaction">
<forward name="admSearchDone" path="/pages/administrator.jsp"/> </action>
...

AdministratorAction:

public class AdministratorAction extends LookupDispatchAction {

 protected Map getKeyMethodMap() {
       Map map = new HashMap();
      map.put("button.search", "search");
   System.out.println((String)map.get("button.search"));
       return map;
   }

 public ActionForward search(ActionMapping mapping,
                     ActionForm form,
                     HttpServletRequest req,
                     HttpServletResponse res) {
   ...
       return mapping.findForward("admSearchDone");
 }
}

The println() writes "search" on the console, so I know that the
getKeyMethodMap()-method is invoked and the mapping should be ok.

So why can't it find my search-method?

The 1.1 release build also fails, but with another error message (this
is probably due to bug 21226
(http://issues.apache.org/bugzilla/show_bug.cgi?id=21226)).


Best regards

Soeren Hjarlvig




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@(protected)
For additional commands, e-mail: struts-user-help@(protected)

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@(protected)
For additional commands, e-mail: struts-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.