%--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--%>
<%@ 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 |
|
|
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 |
|
|
|
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 |
|
|
|