I have been using struts-errors to pass messages from dispatch action class to view page But I found out struts-messages is standard tag to do this First what is difference between these two classes Secondly how to use struts-errors , i tried follwing code but it did not worked
messages.add("PreferencesUpdated",new ActionMessage("Your preferences has been updated"));
saveMessages(request, messages);
request.setAttribute("messages", true);
return mapping.findForward(subscribe);
and in the view page
<span style="font-weight:bold"><html:messages id="PreferencesUpdated" message="true" /></span>
Can anyone tell where is error in the code and difference between and
There is NO any difference ,ActionErrors
are deprecated. all behavior in ActionErrors
was pushed up into ActionMessages
. 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.
Main advantage of ActionMmessage
tag is it does not force to write html tags in properties file but ActionError
object forces to write html tags.