• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cancell function in Struts(Action class)

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
org.apache.struts.action.InvalidCancelException

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");
if(isCancelled(request)){
return mapping.findForward("success");
}
try{
form=buildEmployeeForm(request.getParameter("employeeid"), request);

if("request".equals(mapping.getScope())){
request.setAttribute(mapping.getAttribute(),form);
}else{
HttpSession session=request.getSession();
session.setAttribute(mapping.getAttribute(),form);
}

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

return mapping.findForward(target);
}
}

----------------------------------

please any one can explain me..

thanks & regards,
seetharaman
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Merrill


thanks & regards,
seetharaman
 
Francisco Jimenez
Greenhorn
Posts: 2
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My problem is solved with cancellable="true"

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic