消息(错误)显示
ActionMessages messages = new ActionMessages();
messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("userForm.insert", info.getUserName());
messages.add("activationDate", new ActionMessage("userForm.active", info.getDateLength());
如下可以显示所有消息,并用<li>将它们放入一个list,再加上可定制的header/footer
<html:messages id="message" header="errors.header" footer="errors.footer">
<li><bean:write name="message"/></li>
</html:messages>
如下可以指定只显示某种message
<html:messages id="message" property="<%= org.apache.struts.action.ActionMessages.GLOBAL_MESSAGE %>">
<li><bean:write name="message"/></li>
</html:messages>
<html:messages id="message" property="activationDate">
<li><bean:write name="message"/></li>
</html:messages>
把Messages换成Errors就是错误显示,为了简便,经常一个<html:errors/>了事