The difference between the classes is zero -- all behavior in ActionErrors was pushed up into ActionMessages and all behavior in ActionError was pushed up into ActionMessage. This was done in the attempt to clearly signal that these classes can be used to pass any kind of messages from the controller to the view -- errors being only one kind of message.
The difference between saveErrors(...) and saveMessages(...) is simply the attribute name under which the ActionMessages object is stored, providing two convenient default locations for storing controller messages for use by the view. If you look more closely at the html:errors and html:messages tags, you can actually use them to get an ActionMessages object from any arbitrary attribute name in any scope.
The difference between html:errors and html:messages is purely in syntax and model -- both tags *default* to look for an ActionMessages object under Globals.ERROR_KEY despite the difference in names.html:messages provides more flexibility at the cost of more typing.
Courtsey:https://wiki.apache.org/struts/
1 comments :
That was a nice explanation, thank you!
Post a Comment