KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > servlet > jsp > tagext > ValidationMessage


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */

17
18
19 package javax.servlet.jsp.tagext;
20
21
22 /**
23  * A validation message from either TagLibraryValidator or TagExtraInfo.
24  * <p>
25  * As of JSP 2.0, a JSP container must support a jsp:id attribute
26  * to provide higher quality validation errors.
27  * The container will track the JSP pages
28  * as passed to the container, and will assign to each element
29  * a unique "id", which is passed as the value of the jsp:id
30  * attribute. Each XML element in the XML view available will
31  * be extended with this attribute. The TagLibraryValidator
32  * can then use the attribute in one or more ValidationMessage
33  * objects. The container then, in turn, can use these
34  * values to provide more precise information on the location
35  * of an error.
36  *
37  * <p>
38  * The actual prefix of the <code>id</code> attribute may or may not be
39  * <code>jsp</code> but it will always map to the namespace
40  * <code>http://java.sun.com/JSP/Page</code>. A TagLibraryValidator
41  * implementation must rely on the uri, not the prefix, of the <code>id</code>
42  * attribute.
43  */

44
45 public class ValidationMessage {
46
47     /**
48      * Create a ValidationMessage. The message String should be
49      * non-null. The value of id may be null, if the message
50      * is not specific to any XML element, or if no jsp:id
51      * attributes were passed on. If non-null, the value of
52      * id must be the value of a jsp:id attribute for the PageData
53      * passed into the validate() method.
54      *
55      * @param id Either null, or the value of a jsp:id attribute.
56      * @param message A localized validation message.
57      */

58     public ValidationMessage(String JavaDoc id, String JavaDoc message) {
59     this.id = id;
60     this.message = message;
61     }
62
63
64     /**
65      * Get the jsp:id.
66      * Null means that there is no information available.
67      *
68      * @return The jsp:id information.
69      */

70     public String JavaDoc getId() {
71     return id;
72     }
73
74     /**
75      * Get the localized validation message.
76      *
77      * @return A validation message
78      */

79     public String JavaDoc getMessage(){
80     return message;
81     }
82
83     // Private data
84
private String JavaDoc id;
85     private String JavaDoc message;
86 }
87
Popular Tags