Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

return type of ActionMessages validate(...

 
Matthew Anderson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since ActionErrors validate(... has been replaced with ActionMessages validate(... my code doesn't accept same return type as before. I.e. ActionMessages e = new ActionMessages();
e.add("error", new ActionMessage("error"));
return e;

doesn't work, anyone know why?
 
Ram Chhabra
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of Struts are you using
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Code Exception:
Since ActionErrors validate(... has been replaced with ActionMessages validate...

Not true. In all versions of Struts 1 the return type of the ActionForm's validate method is ActionErrors, just as it has always been. You can verify this for yourself by reading the documentation for the ActionForm class in the Struts 1.3.8 Javadoc.

What may be confusing you is that the class ActionError (No "s" on the end) has been deprecated in favor of ActionMessage. ActionErrors, however, has not been deprecated.
[ July 19, 2007: Message edited by: Merrill Higginson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic