Rafael Taboada wrote the following on 7/11/2005 5:55 PM:
Hi. When I turned off validation yn mi struts-config.xml, validation isn't
called. And when I turned off validation and call validate manually inside a
method of my ActionClass, validation isn't called.
I calle validate method in:
public ActionForward buscarColor(ActionMapping mapping, ActionForm
form,HttpServletRequest request, HttpServletResponse response) {
...
colorForm.validate(mapping,request);
...
}
Maybe I'm calling this validate method in an incorrect way??
Are you 'sure' it's not being called?
You need get the Errors back that are returned and put them in scope.
Here's an example from my code...
//in your Action ...
ActionErrors errors = colorForm.validate( mapping, request );
if ( errors != null && !errors.isEmpty ) {
saveErrors(request, errors);
setUp(request); //puts some things back in scope that I need
return (mapping.findForward(UIconstants.FAILURE));
}
return (mapping.findForward(UIconstants.SUCCESS));
if ( errors != null && !errors.isEmpty ) <-- this part can probably be
shortened, I was too lazy to figure out what really gets returned if
validation passes.. a null or empty ActionErrors?
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]