Re: Deprecating ActionError/ActionErrors
--- Wendy Smoak [EMAIL PROTECTED] wrote: I don't know if this work is still ongoing, but I notice that ActionError and ActionErrors are deprecated, yet the validate method of DynaValidatorForm still returns an ActionErrors object. Only ActionError is deprecated right now. However, most of the references to ActionErrors in Struts have been replaced with ActionMessages. ActionErrors is still around because it's in the ActionForm.validate() method signature. Use ActionMessage and ActionMessages wherever possible for a Struts 1.2 app. Eventually, we'll use Commons Resources' Message and MessageList interfaces. David I looked at the validate method of DynaValidatorForm, and I'm confused. It doesn't seem to do what it says it does. AFAICT, this method *always* returns the empty ActionErrors object that's created with: ActionErrors errors = new ActionErrors(); If errors ARE found, they're never put into that ActionErrors object, they're stored in the protected ValidatorResults object. /** * Validate the properties that have been set from this HTTP request, * and return an codeActionErrors/code object that encapsulates any * validation errors that have been found. If no errors are found, return * codenull/code or an codeActionErrors/code object with no * recorded error messages. * * @param mapping The mapping used to select this instance. * @param request The servlet request we are processing. * @return codeActionErrors/code object that encapsulates any validation errors. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { this.setPageFromDynaProperty(); ServletContext application = getServlet().getServletContext(); ActionErrors errors = new ActionErrors(); Validator validator = Resources.initValidator(mapping.getAttribute(), this, application, request, errors, page); try { validatorResults = validator.validate(); } catch (ValidatorException e) { log.error(e.getMessage(), e); } return errors; } Can someone who knows what's happening with ActionError/ActionErrors please post a summary? -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Deprecating ActionError/ActionErrors
I don't know if this work is still ongoing, but I notice that ActionError and ActionErrors are deprecated, yet the validate method of DynaValidatorForm still returns an ActionErrors object. I looked at the validate method of DynaValidatorForm, and I'm confused. It doesn't seem to do what it says it does. AFAICT, this method *always* returns the empty ActionErrors object that's created with: ActionErrors errors = new ActionErrors(); If errors ARE found, they're never put into that ActionErrors object, they're stored in the protected ValidatorResults object. /** * Validate the properties that have been set from this HTTP request, * and return an codeActionErrors/code object that encapsulates any * validation errors that have been found. If no errors are found, return * codenull/code or an codeActionErrors/code object with no * recorded error messages. * * @param mapping The mapping used to select this instance. * @param request The servlet request we are processing. * @return codeActionErrors/code object that encapsulates any validation errors. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { this.setPageFromDynaProperty(); ServletContext application = getServlet().getServletContext(); ActionErrors errors = new ActionErrors(); Validator validator = Resources.initValidator(mapping.getAttribute(), this, application, request, errors, page); try { validatorResults = validator.validate(); } catch (ValidatorException e) { log.error(e.getMessage(), e); } return errors; } Can someone who knows what's happening with ActionError/ActionErrors please post a summary? -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Deprecating ActionError/ActionErrors
- Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 17, 2003 6:42 PM Subject: Deprecating ActionError/ActionErrors I don't know if this work is still ongoing, but I notice that ActionError and ActionErrors are deprecated, yet the validate method of DynaValidatorForm still returns an ActionErrors object. I looked at the validate method of DynaValidatorForm, and I'm confused. It doesn't seem to do what it says it does. AFAICT, this method *always* returns the empty ActionErrors object that's created with: ActionErrors errors = new ActionErrors(); Well, this is not true. According to the code, the errors object gets passed to the initValidator( ) method which returns a Validator object, and the validator object than calls the validate() method. Since Java pass by reference, the error object could be changed in the initValidator() method as well as in the subsequent validate() method. Saul If errors ARE found, they're never put into that ActionErrors object, they're stored in the protected ValidatorResults object. /** * Validate the properties that have been set from this HTTP request, * and return an codeActionErrors/code object that encapsulates any * validation errors that have been found. If no errors are found, return * codenull/code or an codeActionErrors/code object with no * recorded error messages. * * @param mapping The mapping used to select this instance. * @param request The servlet request we are processing. * @return codeActionErrors/code object that encapsulates any validation errors. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { this.setPageFromDynaProperty(); ServletContext application = getServlet().getServletContext(); ActionErrors errors = new ActionErrors(); Validator validator = Resources.initValidator(mapping.getAttribute(), this, application, request, errors, page); try { validatorResults = validator.validate(); } catch (ValidatorException e) { log.error(e.getMessage(), e); } return errors; } Can someone who knows what's happening with ActionError/ActionErrors please post a summary? -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]