Action中的代码:
ActionMessages actionMessages=new ActionMessages();
actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("......"));
saveMessages(request, actionMessages);
对应的jsp中:
<html:messages id="message" message="true">
<bean:write name="message"/>
</html:messages>
-
name : 指定ActionMessages存放在request或者session内的属性key.
-
message: 指定消息的来源, 如果为true, 对应于key=Globals.MESSAGE_KEY的ActionMessages对象, 此时name属性无效;如果为false, 则根据name属性检索ActionMessages对象, 如果没有设置name, 默认为Globals.ERROR_KEY. message属性的默认值为false.