You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Randy Kennedy <rk...@appriss.com> on 2005/05/11 16:30:29 UTC

LookupDispatchAction - missing resource in key method map

I've banged my head on this problem for at least 4-5 hours, and I'm at 
my wits end.  I've already reviewed several possible solutions, but it 
appears that I have everything in order for using the 
LookupDispatchAction class.

Here's the message that I receive:

---
10:17:29,172 ERROR [Engine] StandardWrapperValve[action]: 
Servlet.service() for servlet action threw exception
javax.servlet.ServletException: Action[/postRespondentFormAction] 
missing resource 'addMemory' in key method map
---

Here is the excerpt from Application.resources:

---
button.respondent.add.memory = continue to protective order
---

Here is the excerpt from struts-config.xml:

---
      <action path="/postRespondentFormAction"
type="com.appriss.vpo.web.struts.protectiveOrder.RespondentFormAction"
              name="respondentForm"
              scope="request"
              validate="true"
              parameter="methodToCall"
              input="/tiles2-new-respondent.do">
         <forward name="continue" path="/home.do" />
      </action>
---

My RespondentFormAction class extends the LookupDispatchAction class and 
has the addMemory method:

---
     public ActionForward addMemory(ActionMapping mapping, ActionForm 
form, HttpServletRequest request, HttpServletResponse response) throws 
Exception { ... }
---

I also populate the map as such:

---
     protected Map getKeyMethodMap() {
         Map map = new HashMap();
         map.put("button.pp.add", "add");
         map.put("button.respondent.add.memory", "addMemory");

         return map;
     }
---

Funny thing is is that I have other LookupDispatchActions working 
correctly in other places.  I don't know what I'm overlooking and doing 
differently with this one.

Any suggestions?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: LookupDispatchAction - missing resource in key method map

Posted by Randy Kennedy <rk...@appriss.com>.
Okay....I figured out what I was doing wrong, so I'm going to post this 
FYI out there just in case someone else makes the same mistake I did.

In my form, I had a hidden field with the same name as the parameter 
(e.g. methodToCall) defined in my action.  After my initialization 
action forwarded to the page, the hidden field was set with the 
parameter value I was passing in (e.g. methodToCall=addMemory).

When I clicked on the add button (button.respondent.add.memory), the 
"addMemory" value was passed to the LookupDispatchAction as the key to 
find the method to call instead of "button.respondent.add.memory".

Hope this explanation makes sense.  I figured it out once I downloaded 
the code and stepped through the code debug mode.

Randy Kennedy wrote:

> I've banged my head on this problem for at least 4-5 hours, and I'm at 
> my wits end.  I've already reviewed several possible solutions, but it 
> appears that I have everything in order for using the 
> LookupDispatchAction class.
>
> Here's the message that I receive:
>
> ---
> 10:17:29,172 ERROR [Engine] StandardWrapperValve[action]: 
> Servlet.service() for servlet action threw exception
> javax.servlet.ServletException: Action[/postRespondentFormAction] 
> missing resource 'addMemory' in key method map
> ---
>
> Here is the excerpt from Application.resources:
>
> ---
> button.respondent.add.memory = continue to protective order
> ---
>
> Here is the excerpt from struts-config.xml:
>
> ---
>      <action path="/postRespondentFormAction"
> type="com.appriss.vpo.web.struts.protectiveOrder.RespondentFormAction"
>              name="respondentForm"
>              scope="request"
>              validate="true"
>              parameter="methodToCall"
>              input="/tiles2-new-respondent.do">
>         <forward name="continue" path="/home.do" />
>      </action>
> ---
>
> My RespondentFormAction class extends the LookupDispatchAction class 
> and has the addMemory method:
>
> ---
>     public ActionForward addMemory(ActionMapping mapping, ActionForm 
> form, HttpServletRequest request, HttpServletResponse response) throws 
> Exception { ... }
> ---
>
> I also populate the map as such:
>
> ---
>     protected Map getKeyMethodMap() {
>         Map map = new HashMap();
>         map.put("button.pp.add", "add");
>         map.put("button.respondent.add.memory", "addMemory");
>
>         return map;
>     }
> ---
>
> Funny thing is is that I have other LookupDispatchActions working 
> correctly in other places.  I don't know what I'm overlooking and 
> doing differently with this one.
>
> Any suggestions?



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org