<% ActionErrors errors = new ActionErrors(); errors.add("property1", new ActionError("property1error1")); errors.add("property2", new ActionError("property2error1")); errors.add("property2", new ActionError("property2error2")); errors.add("property2", new ActionError("property2error3")); errors.add("property3", new ActionError("property3error1")); errors.add("property3", new ActionError("property3error2")); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("globalError")); request.setAttribute(Globals.ERROR_KEY, errors);
ActionMessages messages = new ActionMessages(); messages.add("property1", new ActionMessage("property1message1")); messages.add("property2", new ActionMessage("property2message1")); messages.add("property2", new ActionMessage("property2message2")); messages.add("property2", new ActionMessage("property2message3")); messages.add("property3", new ActionMessage("property3message1")); messages.add("property3", new ActionMessage("property3message2")); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("globalMessage")); request.setAttribute(Globals.MESSAGE_KEY, messages); %>
]]>About Tag state in strutshttp://www.aygfsteel.com/joeyeezhang/archive/2006/01/12/27789.htmljoeyeezhangjoeyeezhangThu, 12 Jan 2006 08:56:00 GMThttp://www.aygfsteel.com/joeyeezhang/archive/2006/01/12/27789.htmlhttp://www.aygfsteel.com/joeyeezhang/comments/27789.htmlhttp://www.aygfsteel.com/joeyeezhang/archive/2006/01/12/27789.html#Feedback0http://www.aygfsteel.com/joeyeezhang/comments/commentRss/27789.htmlhttp://www.aygfsteel.com/joeyeezhang/services/trackbacks/27789.htmlIn struts, there is only one tag instance with one tag, so if there is one state field in tag class, please don't forget to revert the value of the state field before returning . For example: public class UserDefinedTableTag extends TagSupport { private boolean isAddRichScript = false; public int doEndTag() throws JspException {