This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Cancell function in Struts(Action class) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cancell function in Struts(Action class)" Watch "Cancell function in Struts(Action class)" New topic

Cancell function in Struts(Action class)

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

hi All,

i have addemployee form(jsp) in struts...
when i click the cancel button i get exception:
Servlet.service() for servlet action threw exception

below the Action class

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
String target=new String("success");
return mapping.findForward("success");
form=buildEmployeeForm(request.getParameter("employeeid"), request);

HttpSession session=request.getSession();

}catch(Exception ex){System.out.println("ex in GetEmployeAction");}

return mapping.findForward(target);


please any one can explain me..

thanks & regards,
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Starting with Struts version 1.2.9, in order to use the cancel button in an action, you must declare it in the action mapping in the struts-config.xml file by specifying cancellable="true". Otherwise, you will get this message.
[ March 31, 2008: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Thanks a lot Merrill

thanks & regards,
Francisco Jimenez

Joined: Oct 03, 2012
Posts: 2

My problem is solved with cancellable="true"

It is sorta covered in the JavaRanch Style Guide.
subject: Cancell function in Struts(Action class)
Similar Threads
Still not working - DynaValidatorActionForm and checkboxes
Can anyone please help me out?
MS Access NullPointerException
execute method of Struts 1.3.9 Action