Skip to content

Package: JspIdConsumer

JspIdConsumer

Coverage

1: /*
2: * Copyright (c) 1997, 2020 Oracle and/or its affiliates and others.
3: * All rights reserved.
4: * Copyright 2004 The Apache Software Foundation
5: *
6: * Licensed under the Apache License, Version 2.0 (the "License");
7: * you may not use this file except in compliance with the License.
8: * You may obtain a copy of the License at
9: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: package jakarta.servlet.jsp.tagext;
20:
21: /**
22: * <p>
23: * This interface indicates to the container that a tag handler wishes to be provided with a compiler generated ID.
24: * </p>
25: * <p>
26: * The container sets the <code>jspId</code> attribute of the tag handler with an identification string, as part of tag
27: * property initialization. Each tag in a JSP page has a unique <code>jspId</code>, and a given tag in a JSP page always
28: * has the same <code>jspId</code>, even for multiple requests to the page.
29: * </p>
30: * <p>
31: * Tag handler instances that implement <code>JspIdConsumer</code> cannot be reused.
32: * </p>
33: * <p>
34: * Even though the <code>jspId</code> attribute is similar in concept to the <code>jsp:id</code> attribute of an XML
35: * view (see Section JSP.10.1.13 of the spec), they are not related. The <code>jsp:id</code> attribute is available only
36: * at translation time, and the <code>jspId</code> attribute is available only at request time.
37: * </p>
38: * <p>
39: * The JSP container must provide a value for <code>jspId</code> that conforms to the following rules:
40: * </p>
41: * <ul>
42: * <li>It must start with a letter (as defined by the <code>Character.isLetter()</code> method) or underscore ('_').
43: * <li>Subsequent characters may be letters (as defined by the <code>Character.isLetter()</code> method), digits (as
44: * defined by the <code>Character.isDigit()</code> method), dashes ('-'), or underscores ('_')
45: * </ul>
46: * <p>
47: * Note that the rules exclude colons ':' in a <code>jspId</code>, and that they are the same rules used for a component
48: * ID in JavaServer Faces.
49: * </p>
50: *
51: * @since JSP 2.1
52: */
53: public interface JspIdConsumer {
54:
55: /**
56: * Called by the container generated code to set a value for the jspId attribute. An unique identification string,
57: * relative to this page, is generated at translation time.
58: *
59: * @param id The value to use for the jspId attribute
60: */
61: public void setJspId(String id);
62: }