<%@ page language="java" import="org.apache.struts.Globals, org.apache.struts.action.ActionMessage" %> <%@ page import="org.apache.struts.action.ActionMessages"%> <%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html-el" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> Test Error and Message Tags <% ActionMessages errors = new ActionMessages(); errors.add("property1", new ActionMessage("property1error1")); errors.add("property2", new ActionMessage("property2error1")); errors.add("property2", new ActionMessage("property2error2")); errors.add("property2", new ActionMessage("property2error3")); errors.add("property3", new ActionMessage("property3error1")); errors.add("property3", new ActionMessage("property3error2")); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("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); %>

Test Error and Message Tags

ERRORS Tag

Test Type Correct Value Test Result
Errors for Property 1
Property 1, Error 1
Errors for Property 2
Property 2, Error 1
Property 2, Error 2
Property 2, Error 3
All Errors
Property 1, Error 1
Property 2, Error 1
Property 2, Error 2
Property 2, Error 3
Property 3, Error 1
Property 3, Error 2
Global Error

MESSAGES Tag

Test Type Correct Value Test Result
Messages for Property 1
Property 1, Message 1
Messages for Property 2
Property 2, Message 1
Property 2, Message 2
Property 2, Message 3
All Messages
Property 1, Message 1
Property 2, Message 1
Property 2, Message 2
Property 2, Message 3
Property 3, Message 1
Property 3, Message 2
Global Message