Hi,
I don't know how to deal with <html:cancel> button when I use LookupDispatchAction in
Struts.
Any Ideas. Below is my action class. I tried override the cancelled() method.
I'm getting the following error when I click the <html:cancel> button.
javax.servlet.ServletException: Request[/editNewExistingCaller] does not contain handler parameter named method
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:199)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
package com.hdms.action;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.LookupDispatchAction;
/**
* @author Rag
*
*/
public class NewExisitingCallerAction1 extends LookupDispatchAction
{
String target = "";
/** Provides the mapping from resource key to method name.
* @return Resource key / method name map.
*/
public Map<String,String> getKeyMethodMap()
{
// TODO Auto-generated method stub
Map<String,String> map = new HashMap<String,String>();
map.put("newexisiting.caller.button.add", "addNewCaller");
map.put("newexisiting.caller.button.update", "updateExistingCaller");
map.put("newexisiting.caller.button.delete", "deleteExistingCaller");
map.put("newexisiting.caller.button.home", "forwardToHome");
return map;
}
public ActionForward cancelled(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
target = "home";
return mapping.findForward(target);
}
public ActionForward addNewCaller(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
target = "ADDCALLER";
return mapping.findForward(target);
}
public ActionForward updateExistingCaller(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
target = "UPDATECALLER";
return mapping.findForward(target);
}
public ActionForward deleteExistingCaller(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
target = "DELETECALLER";
return mapping.findForward(target);
}
public ActionForward forwardToHome(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
return mapping.findForward("home");
}
}
Thanks in advance.