LookupDispatchAction - getKeyMethodMap() must be implemented error even though it has been implemented.

Posted on 2006-11-07
Last Modified: 2012-06-27
Hi Experts,

I am trying to create dispatch action and I don't know why it is complaining. I still get getKeyMethodMap() must be implemented error message.
Here is what I did.

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.ServletException;
import org.apache.struts.actions.LookupDispatchAction;
import java.util.*;

public class IndividualTestAction extends LookupDispatchAction {

    protected Map getKeyMethodMap(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request) {
          Map map = new HashMap();
          map.put("button.basc", "basc");
          map.put("button.prs", "prs");
          return map;
    public ActionForward basc(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
          throws IOException, ServletException {
          return mapping.findForward("basc");

    public ActionForward prs(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            throws IOException, ServletException {
          return mapping.findForward("success");
any idea?
Question by:dkim18
LVL 23

Accepted Solution

Ajay-Singh earned 200 total points
ID: 17891287
you need to implement a method something like:

protected java.util.Map getKeyMethodMap()  {

Assisted Solution

owenli27 earned 100 total points
ID: 17891596
change your method to:
protected Map getKeyMethodMap( ) {
          Map map = new HashMap();
          map.put("button.basc", "basc");
          map.put("button.prs", "prs");
          return map;

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to add new optional parameter to JSP 1 49
java stored proc example 9 44
How to execute a Python program and gather return output in Java 2 40
Java: anonymous class 4 29
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question