At 4:20 PM +0200 11/23/04, Alpay Ozturk wrote:
Hi All,

I am having a problem with ActionMessages. When I create an
ActionMessages instance in my action and add ActionMessage objects to
it, it is not displayed in my result jsp. But when I create an
ActionErrors instance and add ActionMessage ojects to it, it is
displayed. Below are the action and jsp codes. Only entry with key
error.2 is displayed in result jsp. What am I missing here?

saveMessages and saveErrors both accept an "ActionMessages" object. The difference is simply under which attribute key the objects are stored. If you use saveErrors(request,actionMessages) you'll get what you want.


Objects saved with saveMessages are retrieved by adding the "message='true'" attribute to the html:messages JSTL tag.

The intention is not to differentiate between object types, but to differentiate between the meaning of the messages: "there was a serious problem" vs. "I did what you asked me to do".

Joe


//Action Class
ActionMessages actionMessages = new ActionMessages();
actionMessages.add("test", new ActionMessage("error.1"));
saveMessages(request, actionMessages);
ActionErrors actionErros = new ActionErrors();
actionErros.add("test2", new ActionMessage("error.2"));
saveErrors(request, actionErros);
return mapping.findForward("success");


//result jsp
   <html:messages id="actionMessage" property="test">
      <li><bean:write name="actionMessage"/></li>
   </html:messages>

   <html:messages id="actionError" property="test2">
      <li><bean:write name="actionError"/></li>
   </html:messages>


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex

Reply via email to