struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mike.ra...@barclayscapital.com
Subject RE: ActionMessages won't display
Date Mon, 19 Apr 2004 15:14:17 GMT
Sorry for missing that Matt.

The id = 'varName' is the object name which will hold each message in the
messages list as it iterates through.

All you should need is something along the following:

<logic:messagesPresent message="true">
<!-- are there any ActionMessages present? -->
	<html:messages id="message" message="true">
		<c:out value="${message}" /><br />
	</html:messages>
</logic:messagesPresent>

This will examine the request for an ActionMessages object, then iterate
through it assiging each item to object "message". Then the c:out tag will
output the value of message and add a <br /> as a line break.


-----Original Message-----
From: Matthew Hegarty [mailto:matthew.hegarty@morse.com] 
Sent: 19 April 2004 16:05
To: 'Struts Users Mailing List'
Subject: RE: ActionMessages won't display


Mike
Thanks for response.
I had tried that but to no avail (I mentioned it near the end of my original
message)

I am not clear as to what 'id="messages"' which appears in the html:messages
tag is supposed to refer to. According to the docs:

"The name of a page scope JSP bean that will contain the current element of
the collection of messages on each iteration, if it is not null. [Required]"

http://jakarta.apache.org/struts/userGuide/struts-html.html#messages

Do I have to define this bean at any point other than in the tag?

Matt

-----Original Message-----
From: mike.raath@barclayscapital.com [mailto:mike.raath@barclayscapital.com]
Sent: 19 April 2004 15:54
To: user@struts.apache.org
Subject: RE: ActionMessages won't display


Try setting the message="true" attribute of the <html:messages> tag. The
default is false which means that you are actually testing for ActionErrors
not ActionMessages.

-----Original Message-----
From: Matthew Hegarty [mailto:matthew.hegarty@morse.com] 
Sent: 19 April 2004 15:49
To: 'user@struts.apache.org'
Subject: ActionMessages won't display



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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


------------------------------------------------------------------------
For more information about Barclays Capital, please
visit our web site at http://www.barcap.com.


Internet communications are not secure and therefore the Barclays 
Group does not accept legal responsibility for the contents of this 
message.  Although the Barclays Group operates anti-virus programmes, 
it does not accept responsibility for any damage whatsoever that is 
caused by viruses being passed.  Any views or opinions presented are 
solely those of the author and do not necessarily represent those of the 
Barclays Group.  Replies to this email may be monitored by the Barclays 
Group for operational or business reasons.

------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message