wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cancell function in Struts(Action class)" Watch "Cancell function in Struts(Action class)" New topic
Author

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
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

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 ]

Merrill
Consultant, Sima Solutions
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Thanks a lot Merrill


thanks & regards,
seetharaman
Francisco Jimenez
Greenhorn

Joined: Oct 03, 2012
Posts: 2

My problem is solved with cancellable="true"

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cancell function in Struts(Action class)
 
Similar Threads
getDataSource
Still not working - DynaValidatorActionForm and checkboxes
Can anyone please help me out?
MS Access NullPointerException
execute method of Struts 1.3.9 Action