The messages tag is used to display a set of messages stored as an org.apache.struts.action.

ActionErrors object, an org.apache.struts.ActionMessages object, a String, or a String array in request scope. Similar to the errors tag, this tag will take the stored messages and iterate over them; however, instead of actually outputting the messages to the JSP, this tag behaves similar to Logic Tag Library’s iterate tag. For each iteration, it stores the current message in a page scope JSP variable.

Example:

In this example, it will display the entire message currently stored. For limit the messages, you can specify that property when using the messages tag.

<html:messages id=”message” >
<li><bean:write name=”message”/></li>
</html:messages>

Example:

In this example, only the messages associated with the property specified by the property attribute will be displayed.

<html:messages id=”message” property=”name” >
<li><bean:write name=”message”/></li>
</html:messages>