• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 490
  • Last Modified:

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

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 java.io.IOException;
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 {
          System.out.println("basc");
          return mapping.findForward("basc");
        }

    public ActionForward prs(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            throws IOException, ServletException {
            System.out.println("prs");
          return mapping.findForward("success");
        }
}
++++++++++++
any idea?
0
dkim18
Asked:
dkim18
2 Solutions
 
Ajay-SinghCommented:
you need to implement a method something like:

protected java.util.Map getKeyMethodMap()  {
}
0
 
Weiping DuSenior Web DeveloperCommented:
change your method to:
protected Map getKeyMethodMap( ) {
          Map map = new HashMap();
          map.put("button.basc", "basc");
          map.put("button.prs", "prs");
          return map;
        }
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now