• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

LookupDispatchAction and <html:cancel> struts

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Look ma! I'm selling my stuff!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic