mmm usually for errors I will use ActionErrors. But from what I understand about ActionMessages if you do:
<html:messages id="messages" message="true"/>
Struts will get all the mesages from request that are tied to ActionMessages.GLOBAL_MESSAGE.
So perhaps we can try to remove the logic tag <logic:present name="<%=Action.MESSAGE_KEY%>"> ......
I feel there is no need for a logic tag over there, So Matt is there any specific reason for the logic tag to be there ?
I can be wrong in this but hope this can help.
Cheers, Irfandhy
Matthew Hegarty wrote:
Hello I am hoping someone can help with an ActionMessages problem
I am setting ActionMessages in my action, but they are not appearing in the page. The action code is:
if(showDetails.size() == 0 ) { LOGGER.debug("no ShowDetails found"); ActionMessages messages = new ActionMessages(); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.none.found", "showDetail")); saveMessages(request,messages); return mapping.findForward("none"); }
The JSP code is:
<logic:present name="<%=Action.MESSAGE_KEY%>"> <P>
messages found:
<html:messages id="messages" name="<%=ActionMessages.GLOBAL_MESSAGE%>" bundle="JSP_MESSAGES"/>
</P> </logic:present>
The log output confirms that the java snippet is called. The 'messages found' string appears in the JSP, but no error message. I have tried various configurations of params to the 'messages' tag, including adding "message='true'".
I have the following in struts-config.xml
<message-resources key="JSP_MESSAGES" parameter="jsp-messages" null="false"/>
I have a file in 'WEB-INF/classes' called 'jsp-messages.properties'
This contains the string: 'errors.none.found=No {0}(s) were found'
Hope someone can help - this one's got me stumped!
cheers Matt
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]