From cf1d2c8d875848a90e1bb683ea1f65ddc7e93037 Mon Sep 17 00:00:00 2001 From: Mark Thomas Date: Sun, 17 May 2020 14:53:38 +0100 Subject: [PATCH] First pass reviewing formatting Cross-references, conversion errors, minor updates for Jakarta, reference Jakarta versions of specifications Signed-off-by: Mark Thomas --- spec/src/main/asciidoc/ServerPages.adoc | 2951 ++++++++++++----------- 1 file changed, 1479 insertions(+), 1472 deletions(-) diff --git a/spec/src/main/asciidoc/ServerPages.adoc b/spec/src/main/asciidoc/ServerPages.adoc index c44d09e1..fbb2658e 100644 --- a/spec/src/main/asciidoc/ServerPages.adoc +++ b/spec/src/main/asciidoc/ServerPages.adoc @@ -1,3 +1,4 @@ +:xrefstyle: full :sectnums!: == Jakarta Server Pages Specification, Version 3.0 @@ -41,9 +42,7 @@ different readerships. This document comprises of a number of Chapters and Appendices that are organized into 3 parts. In addition, -the document contains a <> -(this section), a link:jsp-1.html#a1[See Status.], and an -<>. +the document contains a <> (this section) and an <>. <> contains several chapters intended for all JSP Page Authors. These @@ -206,14 +205,10 @@ generate dynamic content encapsulate behavior and state * Static HTML, DHTML, XHTML, XML, and similar pages. -* Client-side Java Applets, JavaBeans -components, and arbitrary Java class files -* Java Runtime Environment(s) running in -client(s) (downloadable via the Plugin and Java™ Web Start technology) The Jakarta Server Pages specification inherits from the servlet specification the concepts of web applications, -`ServletContexts` , sessions, and requests and responses. See the Jakarta +`ServletContexts`, sessions, and requests and responses. See the Jakarta Servlet specification for more details. === Components and Containers @@ -240,7 +235,7 @@ at request time. The instantiated JSP page object handles requests and creates responses. JSP pages may be translated prior to their -use, providing the web application, with a servlet class that can serve +use, providing the web application with a servlet class that can serve as the textual representation of the JSP page. The translation may also be done by the JSP @@ -319,9 +314,11 @@ this class of user: * <> and <> of <> * <> * <> of <> -* link:jsp.html#UNKNOWN[See Core API.] -* Appendices <>, link:jsp.html#a3054[See JSP Elements of -web.xml.], <>, and <> +* Appendices <>, <>, and <> + +Advanced page authors may also wish to look at the Javadoc for the +`jakarta.servlet.jsp` package and the XML schema for the JSP 3.0 +deployment descriptor. === Tag Library Developers @@ -339,10 +336,12 @@ this class of user: * <> and <> of <> * <> * <> -* l<> of <> -* link:jsp.html#UNKNOWN[See Core API.] and link:jsp.html#UNKNOWN[See Tag Extension API.] +* <> of <> * All Appendices +Tag library developers may also wish to look at the Javadoc for the +`jakarta.servlet.jsp` and `jakarta.servlet.jsp.tagext` packages. + === Deployers A deployer is an expert in a specific @@ -396,7 +395,7 @@ The chapters of this part are: == Core Syntax and Semantics This chapter describes the core syntax -and semantics for the Jakarta Server Pages 2.2 specification (JSP 2.2). +and semantics for the Jakarta Server Pages 3.0 specification (JSP 3.0). === What Is a JSP Page @@ -408,7 +407,7 @@ and/or using other objects. A JSP page defines a JSP page implementation class that implements the semantics of the JSP page. This class implements the `jakarta.servlet.Servlet` interface (see -/C:/jspspec/JSP`Engine.html#57518[] for details). At request time a +<> for details). At request time a request intended for the JSP page is delivered to the JSP page implementation object for processing. @@ -464,7 +463,7 @@ The JSP 1.2 specification made a stronger distinction between JSP documents and non-XML JSP pages. For instance standard actions like were only available in JSP documents. The difference proved to be confusing and distracting and the -distinction has been relaxed in JSP 2.0 to facilitate the transition +distinction was relaxed in JSP 2.0 to facilitate the transition from the JSP syntax to XML syntax. ==== Translation and Execution Phases @@ -496,13 +495,13 @@ the appropriate JSP page implementation object. Upon completion of processing, the response object is received by the container for communication to the client. The details of the contract between the JSP page implementation class and the JSP container are described in -/C:/jspspec/JSP`Engine.html#57518[]. +<>. The translation of a JSP source page into its implementation class can occur at any time between initial deployment of the JSP page into the JSP container and the receipt and processing of a -client request for the target JSP page. <> describes how to perform the translation phase -ahead of deployment. +client request for the target JSP page. <> describes +how to perform the translation phase ahead of deployment. ==== Validating JSP pages @@ -550,7 +549,7 @@ whether the EL evaluation and the scripting machinery is enabled, and prelude and coda automatic inclusions. The JSP configuration information can also be used to indicate that some resources in the web application are JSP files even if they do not conform to the default `.jsp` -extension, and to modify the default interpretation for `.jspx` . +extension, and to modify the default interpretation for `.jspx`. ==== Naming Conventions for JSP Files @@ -617,12 +616,12 @@ time. ===== JSP Page Packaging When a JSP page implementation class depends -on support classes in addition to the JSP 2.2 and Servlet 2.5 classes, +on support classes in addition to the JSP 3.0 and Servlet 5.0 classes, the support classes are included in the packaged WAR, as defined in the -Servlet 2.5 specification, for portability across JSP containers. +Servlet 5.0 specification, for portability across JSP containers. -CompilingJSPs.html#57437[] -contains two examples of JSP pages packaged in WARs: +<> contains two examples of JSP pages packaged in +WARs: . A JSP page delivered in source form (the most common case). @@ -637,9 +636,9 @@ implementation class for that page. In the past debugging tools provided by development environments have lacked a standard format for conveying source map information allowing the debugger of one vendor to be used -with the JSP container of another. As of JSP 2.0, containers must -support JSR-045 (“Debugging Support for Other Languages”). Details can -be found in /C:/jspspec/JSP`Engine.html#64050[]. +with the JSP container of another. JSP 3.0 containers must +support the Jakarta Debugging Support for Other Languages Specification. +Details can be found in <>. === Web Applications @@ -658,21 +657,17 @@ encapsulate behavior and state * Static HTML, DHTML, XHTML, XML and similar pages. * Resource files used by Java classes. -* Client-side Java Applets, JavaBeans -components, and Java class files -* Java runtime environment(s) (downloadable -via the Plugin and Java Web Start) running in client(s) Web applications are described in more detail -in the Servlet 2.5 specification. +in the Servlet 5.0 specification. A web application contains a deployment descriptor `web.xml` that contains information about the JSP pages, servlets, and other resources used in the web application. The -deployment descriptor is described in detail in the Servlet 2.5 +deployment descriptor is described in detail in the Servlet 5.0 specification. -JSP 2.2 requires that these resources be +JSP 3.0 requires that these resources be implicitly associated with and accessible through a unique `ServletContext` instance available as the implicit `application` object (see <>). @@ -681,23 +676,21 @@ The application to which a JSP page belongs is reflected in the `application` object, and has impact on the semantics of the following elements: -* The `include` directive (see <>). -* The `taglib` directive (see <>). -* The `jsp:include` action element (see -StandardActions.html#39949[]). -* The `jsp:forward` action (see -StandardActions.html#23283[]). +* The `include` directive (see <>). +* The `taglib` directive (see <>). +* The `jsp:include` action element (see <>). +* The `jsp:forward` action (see<>). -JSP 2.2 supports portable packaging and -deployment of web applications through the Servlet 2.5 specification. +JSP 3.0 supports portable packaging and +deployment of web applications through the Servlet 5.0 specification. The Jakarta Server Pages specification inherits from the servlet -specification the concepts of applications, `ServletContext`s , -Sessions, Requests and Responses. +specification the concepts of applications, `ServletContexts`, +`Sessions`, `Requests` and `Responses`. ==== Relative URL Specifications Elements may use relative URL specifications, -called URI paths, in the Servlet 2.5 specification. These paths are as +called URI paths, in the Servlet 5.0 specification. These paths are as described in RFC 3986. We refer to the path part of that specification, not the scheme, nor authority parts. Some examples are: @@ -709,15 +702,16 @@ application to which the JSP page or tag file belongs. That is, its not start with a slash (/). It is to be interpreted as relative to the current JSP page, or the current JSP file or tag file, depending on where the path is being used. For an `include` directive (see -<>) where the path +<>) where the path is used in a `file` attribute, the interpretation is relative to the JSP -file or tag file. For a `jsp:include` action (see -StandardActions.html#39949[]) where the path is used in a +file or tag file. For a `jsp:include` action (see <>) +where the path is used in a `page` attribute, the interpretation is relative to the JSP page. In both cases the current page or file is denoted by some path starting with `/` that is then modified by the new specification to produce a -path starting with `/` . The new path is interpreted through the -`ServletContext` object. See <> for exact details on this interpretation. +path starting with `/`. The new path is interpreted through the +`ServletContext` object. See <> for exact +details on this interpretation. The JSP specification uniformly interprets paths in the context of the web container where the JSP page is @@ -754,13 +748,13 @@ conceptually valid independent of any specific request received by the JSP page. They provide information for the translation phase. Directive elements have a syntax of the form -`<%@ directive...%>`. +`<%@ directive\...%>`. _Actions_ + Actions provide information for the request processing phase. The interpretation of an action may, and often will, depend on the details of the specific request received by the JSP page. -An Actions can either be standard (that is. defined in this +An Action can either be standard (that is, defined in this specification), or custom (that is, provided via the portable tag extension mechanism). @@ -769,12 +763,12 @@ element. They have a start tag including the element name, and may have attributes, an optional body, and a matching end tag, or may be an empty tag, possibly with attributes: - body + body And: - - + + An element has an element type describing its tag name, its valid attributes and its semantics. We refer to the type @@ -796,21 +790,20 @@ template text and actions. The Expression Language (EL) can be used to simplify accessing data from different sources. EL expressions can be used in JSP standard and custom actions and template data. EL -expressions use the syntax `${expr}` and `#{expr}`; For example: +expressions use the syntax `${expr}` and `#{expr}`. For example: - + ${map[entry]} ${3+counter} -/C:/jspspec/JSP`Expression`Language.html#98642[] -provides more details on the EL. +<> provides more details on the EL. There are three language-based types of scripting elements: declarations, scriptlets, and expressions. -Declarations follow the syntax `<%! ... %>`. Scriptlets follow the -syntax `<% ... %>`. Expressions follow the syntax `<%= ... %>`. +Declarations follow the syntax `<%! \... %>`. Scriptlets follow the +syntax `<% \... %>`. Expressions follow the syntax `<%= \... %>`. ==== Start and End Tags @@ -820,14 +813,14 @@ tag cannot be on one file while the end tag is in another. The same rule applies to elements in the alternate syntax. For example, a scriptlet has the syntax `<% scriptlet -%>` . Both the opening `<%` characters and the closing `%>` +%>`. Both the opening `<%` characters and the closing `%>` characters must be in the same physical file. A scripting language may also impose constraints on the placement of start and end tags relative to specific -scripting constructs. For example, /C:/jspspec/JSP`Scripting.html#68206[] +scripting constructs. For example, <> shows that Java language blocks cannot separate a start and an end tag. -See /C:/jspspec/JSP`Scripting.html#33172[] for details. +See <
> for details. ==== Empty Elements @@ -872,7 +865,7 @@ As of JSP 2.0, page authors can provide input in new ways using the `` standard action element. Based on the configuration of the action being invoked, the body of the element either specifies a value that is evaluated once, or it specifies -a “JSP fragment,” which represents the body in a form that makes it +a “JSP fragment”, which represents the body in a form that makes it possible for a tag handler to evaluate it as many times as needed. The `` action must only be used to specify an attribute value for standard or custom actions. A translation error must occur if it is @@ -882,7 +875,7 @@ text that looks like an XML element. It is illegal JSP syntax, which must result in a translation error, to use both an XML element attribute and a `` standard action to pass the value of the same -attribute. See StandardActions.html#29033[] for more +attribute. See <> for more details on the `` standard action. The following example uses an XML element @@ -891,9 +884,9 @@ attribute standard action to define the value of the `param2` attribute. In this example, the value of `param2` comes from the result of a custom action invocation. - - - + + + @@ -901,9 +894,8 @@ If a page author wishes to pass both an attribute standard action and a tag body, the `` standard action must be used to specify the body. A translation error will result if the custom action invocation has `` elements but does -not define the body using a `` element. See -StandardActions.html#89308[] for more details on the -`` standard action. +not define the body using a `` element. See <> for +more details on the `` standard action. The following example shows two equivalent tag invocations to the hypothetical `` custom action. @@ -912,12 +904,12 @@ the `color` and `size` attributes. The second example uses an attribute standard action to pass the value of the `color` attribute. Both examples have tag body containing simply the words “Template Text”. - + Template Text - - blue + + blue Template Text @@ -928,8 +920,8 @@ examples have tag body containing simply the words “Template Text”. structured way. The example below generates an HTML head of some type unknown at page authoring time: - - ${headSize} + + ${headSize} ${headText} @@ -940,14 +932,14 @@ convention (i.e. must be an `NMTOKEN` as indicated in the XML 1.0 specification). The names for attributes must follow the conventions described in the JavaBeans specification. -Attribute names that start with `jsp` , -`jsp` , `jakarta` are reserved in this specification. +Attribute names that start with `jsp`, `jsp` and `jakarta` are +reserved in this specification. ==== White Space In HTML and XML white space is usually not significant, but there are exceptions. For example, an XML file may -start with the characters `` -|2|`<%@ page buffer=”8kb” %>` +|1|`` +|2|`<%@ page buffer="8kb" %>` |3|The rest of the document goes here |=== @@ -975,7 +967,7 @@ The result is [cols="20,80",options="header"] |=== |LineNo|Output Text -|1|`` +|1|`` |2| |3|The rest of the document goes here |=== @@ -983,23 +975,23 @@ The result is The next two tables show another example, with input and output. -.Example 1 - Input +.Example 2 - Input [cols="20,80",options="header"] |=== |LineNo|Source Text -|1|`<% response.setContentType(“....”);` -|2|`whatever... %>` -|3|`<%@ page buffer=”8kb” %>` +|1|`<% response.setContentType("\...");` +|2|`whatever\... %>` +|3|`<%@ page buffer="8kb" %>` |4|The rest of the document goes here |=== The result is -.Example 1 - Output +.Example 2 - Output [cols="20,80",options="header"] |=== |LineNo|Output Text -|1|`` +|1|`` |2| |3|The rest of the document goes here |=== @@ -1007,11 +999,11 @@ The result is It is possible to have extraneous whitespaces removed from template text through element `trim-directive-whitespaces` of JSP Property Groups (See -#70753[]), or the page and tag file +<>), or the page and tag file directive attribute `trimDirectiveWhitespaces` (See -<>, -/C:/jspspec/JSP`Tag`Files.html#79361[]). +<>, <>). +[[_JSP_Documents]] ==== JSP Documents A JSP page is usually passed directly to a @@ -1023,19 +1015,19 @@ the consequences of this are: * The document must be well-formed * Validation, if indicated * Entity resolution will apply, if indicated -* `<%` style syntax cannot be used +* `<%` style syntax cannot be used JSP documents are often a good match for the generation of dynamic XML content as they can preserve much of the structure of the generated document. The default convention for JSP documents is -`.jspx` . There are configuration elements that can be used to indicate +`.jspx`. There are configuration elements that can be used to indicate that a specific file is a JSP document. -See JSPDocuments.html#64789[] for +See <> for more details on JSP documents, and -#43756[] for more details on +<> for more details on configuration. ==== JSP Syntax Grammar @@ -1065,21 +1057,21 @@ EBNF definition in the XML 1.0 specification. Refer to * Where applicable, to resolve grammar ambiguities, the first matching production must always be followed. This is commonly known as the “greedy” algorithm. -* If the `` production is +* If the `` production is followed, the page is invalid, and the result will be a translation error. * Many productions make use of XML-style attributes. These attributes can appear in any order, separated from each other by whitespace, but no attribute can be repeated more than once. To make these XML-style attribute specifications more concise and -easier to read, the syntax `ATTR[ attrset ]` is used in the EBNF to +easier to read, the syntax `ATTR[attrset]` is used in the EBNF to define a set of XML attributes that are recognized in a particular production. + + -Within the square brackets ( `attrset` ) is +Within the square brackets (`attrset`) is listed a comma-separated list of case-sensitive attribute names that are valid. Each attribute name represents a single XML attribute. If the -attribute name is prefixed with an `=` , the production `Attribute` +attribute name is prefixed with an `=`, the production `Attribute` (defined below) must be matched (either a `rtexprvalue` or a static value is accepted). If not, the production `NonRTAttribute` must be matched (only static values are accepted). If the attribute name is @@ -1089,7 +1081,7 @@ for this production to be matched. If an attribute that matches the the other attributes, the production is not matched. + + For example, consider a production that -contains `ATTR[ !name, =value, =!repeat ]` . This production is matched +contains `ATTR[!name, =value, =!repeat]`. This production is matched if and only if all of the following hold true: + * The `name` attribute appears exactly once and matches the `NonRTAttribute` production. @@ -1097,15 +1089,15 @@ and matches the `NonRTAttribute` production. If it appears, the `Attribute` production must be matched. * The `repeat` attribute appears exactly once and matches the `Attribute` production. -* There must be no other attributes aside from `name` , `value` , or `repeat`. +* There must be no other attributes aside from `name`, `value`, or `repeat`. For example, the following sample strings match the above: -* `name=”somename” value=”somevalue” -repeat=”2”` +* `name="somename" value="somevalue" +repeat="2"` -* `repeat=”${ x + y }” name=”othername”` +* `repeat="${ x + y }" name="othername"` ===== EBNF Grammar for JSP Syntax @@ -1119,65 +1111,65 @@ Body ::= AllBody | ScriptlessBody [ vc: ScriptingEnabled ] [ vc: ScriptlessBody ] -AllBody ::= ( ( ‘<%--’ JSPCommentBody ) - | ( ‘<%@’ DirectiveBody ) - | ( ‘ ) - | ( ‘ ) + | ( ' ) - | ( ‘<%=’ ) - | ( ‘ ) - | ( ‘<%’ ) - | ( ‘ ) - | ( ‘${‘ ELExpressionBody ) - | ( ‘#{‘ ELExpressionBody ) - | ( ‘ ) + | ( '<%' ) + | ( ' ) + | ( '${' ELExpressionBody ) + | ( '#{' ELExpressionBody ) + | ( ' ) - | ( ‘ ) - | ( ‘<%=’ ) - | ( ‘ ) - | ( ‘<%’ ) - | ( ‘ ) - | ( ‘${‘ ) - | ( ‘#{‘ ) - | ( ‘ ) - | ( ‘ ) - | ( ‘<‘ CustomAction ) +TemplateTextBody ::= ( ( '<%--' JSPCommentBody ) + | ( '<%@' DirectiveBody ) + | ( ' ) + | ( ' ) + | ( '<%=' ) + | ( ' ) + | ( '<%' ) + | ( ' ) + | ( '${' ) + | ( '#{' ) + | ( ' ) + | ( ' ) + | ( '<' CustomAction ) | TemplateText )* [ vc: ELEnabled ] -JSPCommentBody ::= ( Char* - ( Char* ‘--%>’ ) ) ‘--%>’ +JSPCommentBody ::= ( Char* - ( Char* '--%>' ) ) '--%>' | DirectiveBody ::= JSPDirectiveBody | TagDefDirectiveBody @@ -1187,44 +1179,44 @@ XMLDirectiveBody ::= XMLJSPDirectiveBody | XMLTagDefDirectiveBody [ vc: TagFileSpecificXMLDirectives ] JSPDirectiveBody ::= S? - ( ( ‘page’ S PageDirectiveAttrList ) - | ( ‘taglib’ S TagLibDirectiveAttrList ) - | ( ‘include’ S IncludeDirectiveAttrList ) + ( ( 'page' S PageDirectiveAttrList ) + | ( 'taglib' S TagLibDirectiveAttrList ) + | ( 'include' S IncludeDirectiveAttrList ) ) - S? ‘%>’ + S? '%>' | XMLJSPDirectiveBody ::= S? - ( ( ‘page’ S PageDirectiveAttrList S? - ( ‘/>’ | ( ‘>’ S? ETag ) ) + ( ( 'page' S PageDirectiveAttrList S? + ( '/>' | ( '>' S? ETag ) ) ) - | ( ‘include’ S IncludeDirectiveAttrList S? - ( ‘/>’ | ( ‘>’ S? ETag ) ) + | ( 'include' S IncludeDirectiveAttrList S? + ( '/>' | ( '>' S? ETag ) ) ) ) | TagDefDirectiveBody ::= S? - ( ( ‘tag’ S TagDirectiveAttrList ) - | ( ‘taglib’ S TagLibDirectiveAttrList ) - | ( ‘include’ S IncludeDirectiveAttrList ) - | ( ‘attribute’ S AttributeDirectiveAttrList ) - | ( ‘variable’ S VariableDirectiveAttrList ) + ( ( 'tag' S TagDirectiveAttrList ) + | ( 'taglib' S TagLibDirectiveAttrList ) + | ( 'include' S IncludeDirectiveAttrList ) + | ( 'attribute' S AttributeDirectiveAttrList ) + | ( 'variable' S VariableDirectiveAttrList ) ) - S? ‘%>’ + S? '%>' | -XMLTagDefDirectiveBody ::= ( ( ‘tag’ S TagDirectiveAttrList S? - ( ‘/>’ | ( ‘>’ S? ETag ) ) +XMLTagDefDirectiveBody ::= ( ( 'tag' S TagDirectiveAttrList S? + ( '/>' | ( '>' S? ETag ) ) ) - | ( ‘include’ S IncludeDirectiveAttrList S? - ( ‘/>’ | ( ‘>’ S? ETag ) ) + | ( 'include' S IncludeDirectiveAttrList S? + ( '/>' | ( '>' S? ETag ) ) ) - | ( ‘attribute’ S AttributeDirectiveAttrList S? - ( ‘/>’ | ( ‘>’ S? ETag ) ) + | ( 'attribute' S AttributeDirectiveAttrList S? + ( '/>' | ( '>' S? ETag ) ) ) - | ( ‘variable’ S VariableDirectiveAttrList S? - ( ‘/>’ | ( ‘>’ S? ETag ) ) + | ( 'variable' S VariableDirectiveAttrList S? + ( '/>' | ( '>' S? ETag ) ) ) ) | @@ -1259,53 +1251,53 @@ VariableDirectiveAttrList ::= ATTR[ !name-given, variable-class, scope, declare, description ] [ vc: UniqueVariableName ] -DeclarationBody ::= ( Char* - ( Char* ‘%>’ ) ) ‘%>’ +DeclarationBody ::= ( Char* - ( Char* '%>' ) ) '%>' | -XMLDeclarationBody ::= ( S? ‘/>’ ) - | ( S? ‘>’ - ( ( Char* - ( Char* ‘<‘ ) ) CDSect? )* +XMLDeclarationBody ::= ( S? '/>' ) + | ( S? '>' + ( ( Char* - ( Char* '<' ) ) CDSect? )* ETag ) | -ExpressionBody ::= ( Char* - ( Char* ‘%>’ ) ) ‘%>’ +ExpressionBody ::= ( Char* - ( Char* '%>' ) ) '%>' | [ vc: ExpressionBodyContent ] -XMLExpressionBody ::= ( S? ‘/>’ ) - | ( S? ‘>’ - ( ( Char* - ( Char* ‘<’ ) ) CDSect? )* +XMLExpressionBody ::= ( S? '/>' ) + | ( S? '>' + ( ( Char* - ( Char* '<' ) ) CDSect? )* ETag ) | [ vc: ExpressionBodyContent ] -ELExpressionBody ::= ELExpression ‘}’ +ELExpressionBody ::= ELExpression '}' | ELExpression ::= [See EL spec document, production *Expression*] -ScriptletBody ::= ( Char* - ( Char* ‘%>’ ) ) ‘%>’ +ScriptletBody ::= ( Char* - ( Char* '%>' ) ) '%>' | ` -XMLScriptletBody ::= ( S? ‘/>’ ) - | ( S? ‘>’ - ( ( Char* - ( Char* ‘<’ ) ) CDSect? )* +XMLScriptletBody ::= ( S? '/>' ) + | ( S? '>' + ( ( Char* - ( Char* '<' ) ) CDSect? )* ETag ) | -StandardAction ::= ( ‘useBean’ StdActionContent ) - | ( ‘setProperty’ StdActionContent ) - | ( ‘getProperty’ StdActionContent ) - | ( ‘include’ StdActionContent ) - | ( ‘forward’ StdActionContent ) - | ( ‘plugin’ StdActionContent ) - | ( ‘invoke’ StdActionContent ) - | ( ‘doBody’ StdActionContent ) - | ( ‘element’ StdActionContent ) - | ( ‘output’ StdActionContent ) +StandardAction ::= ( 'useBean' StdActionContent ) + | ( 'setProperty' StdActionContent ) + | ( 'getProperty' StdActionContent ) + | ( 'include' StdActionContent ) + | ( 'forward' StdActionContent ) + | ( 'plugin' StdActionContent ) + | ( 'invoke' StdActionContent ) + | ( 'doBody' StdActionContent ) + | ( 'element' StdActionContent ) + | ( 'output' StdActionContent ) | [ vc: TagFileSpecificActions ] @@ -1318,26 +1310,26 @@ StdActionBody ::= EmptyBody | PluginBody [ vc: StdActionBodyMatch ] -EmptyBody ::= ‘/>’ - | ( ‘>’ ETag ) - | ( ‘>’ S? ‘' ETag ) + | ( '>' S? '’ TagDependentBody ETag ) + | ( '>' TagDependentBody ETag ) TagDependentBody ::= Char* - ( Char* ETag ) -JspAttributeAndBody ::= ( ‘>’ S? ( ‘' S? ( ' ) S? ETag ) ActionBody ::= JspAttributeAndBody - | ( ‘>’ Body ETag ) + | ( '>' Body ETag ) ScriptlessActionBody ::= JspAttributeAndBody - | ( ‘>’ ScriptlessBody ETag ) + | ( '>' ScriptlessBody ETag ) OptionalBody ::= EmptyBody | ActionBody @@ -1346,29 +1338,29 @@ ScriptlessOptionalBody ::= EmptyBody | ScriptlessActionBody TagDependentOptionalBody ::= EmptyBody | TagDependentActionBody ParamBody ::= EmptyBody - | ( ‘>’ S? ( ‘' S? ( ') S? ETag ) - | ( S? ‘>’ Param* ETag ) + | ( S? '>' Param* ETag ) PluginBody ::= EmptyBody - | ( ‘>’ S? ( ‘' S? ( ' ) S? ETag ) - | ( ‘>’ S? PluginTags ETag ) + | ( '>' S? PluginTags ETag ) -NamedAttributes ::= AttributeBody S? ( ‘’ - | ‘>’ - | ‘>’ AttributeBodyBody ‘’ + ( '/>' + | '>' + | '>' AttributeBodyBody '' | ) @@ -1378,53 +1370,53 @@ AttributeBodyBody ::= AllBody [ vc: AttributeBodyMatch ] JspBodyBody ::= ( S? JspBodyEmptyBody ) - | ( S? ‘>’ ( JspBodyBodyContent - ‘’ ) ‘’ ) + | ( S? '>' ( JspBodyBodyContent - '' ) '' ) JspBodyBodyContent ::= ScriptlessBody | Body | TagDependentBody [ vc: JspBodyBodyContent ] -JspBodyEmptyBody ::= ‘/>’ - | ‘>’ +JspBodyEmptyBody ::= '/>' + | '>' | -JspBodyParam ::= S? ‘>’ S? Param* ‘’ +JspBodyParam ::= S? '>' S? Param* '' -JspBodyPluginTags ::= S? ‘>’ S? PluginTags ‘’ +JspBodyPluginTags ::= S? '>' S? PluginTags '' -PluginTags ::= ( ‘’ S? - ( ( ‘’ - ( ( S? Param+ S? ‘’ ) +Params ::= '>' S? + ( ( '' + ( ( S? Param+ S? '' ) | ) ) | Param+ ) - ’’ + '' -Fallback ::= ’/>’ - | ( ‘>’ S? ‘’ +Fallback ::= '/>' + | ( '>' S? '' ( ( S? - ( Char* - ( Char* ‘’ ) ) - ‘’ S? + ( Char* - ( Char* '' ) ) + '' S? ) | ) - ‘’ + '' ) - | ( ’>’ - ( Char* - ( Char* ’’ ) ) - ’’ + | ( '>' + ( Char* - ( Char* '' ) ) + '' ) -Param ::= ’’ ) - | ( S? ‘>’ - ( ( Char* - ( Char* ( ‘<’ | ‘${‘ | ‘#{‘ ) ) ) - ( ( ‘${‘ ELExpressionBody )? - | ( ‘#{‘ ELExpressionBody )? +XMLTemplateText ::= ( S? '/>' ) + | ( S? '>' + ( ( Char* - ( Char* ( '<' | '${' | '#{' ) ) ) + ( ( '${' ELExpressionBody )? + | ( '#{' ELExpressionBody )? ) CDSect? )* ETag @@ -1472,19 +1464,19 @@ XMLTemplateText ::= ( S? ‘/>’ ) ExtraClosingTag ::= ETag [ vc: ExtraClosingTagMatch ]` -ETag ::= ‘’ +ETag ::= '' [ vc: ETagMatch ]` Attribute ::= Name Eq - ( ( ‘”<%=’ RTAttributeValueDouble ) - | ( “‘<%=” RTAttributeValueSingle ) - | ( ‘”’ AttributeValueDouble ) - | ( “‘” AttributeValueSingle ) + ( ( '"<%=' RTAttributeValueDouble ) + | ( "'<%=" RTAttributeValueSingle ) + | ( '"' AttributeValueDouble ) + | ( "'" AttributeValueSingle ) ) NonRTAttribute ::= Name Eq - ( ( ‘”’ AttributeValueDouble ) - | ( “‘” AttributeValueSingle ) + ( ( '"' AttributeValueDouble ) + | ( "'" AttributeValueSingle ) ) AnyAttributeValue ::= AttributeValue | RTAttributeValue @@ -1493,23 +1485,23 @@ AttributeValue ::= AttributeValueDouble | AttributeValueSingle RTAttributeValue ::= RTAttributeValueDouble | RTAttributeValueSingle -AttributeValueDouble ::= ( QuotedChar - ‘”’ )* - ( ‘”’ | ) +AttributeValueDouble ::= ( QuotedChar - '"' )* + ( '"' | ) -AttributeValueSingle ::= ( QuotedChar - “‘” )* - ( “‘” | ) +AttributeValueSingle ::= ( QuotedChar - "'" )* + ( "'" | ) -RTAttributeValueDouble ::= ( ( QuotedChar - ‘”’ )* - - ( ( QuotedChar - ’"’ )* ’%>’ ) +RTAttributeValueDouble ::= ( ( QuotedChar - '"' )* - + ( ( QuotedChar - '"' )* '%>' ) ) - ( ’%>"’ | ) + ( '%>"' | ) [ vc: RTAttributeScriptingEnabled ] [ vc: ExpressionBodyContent ] -RTAttributeValueSingle ::= ( ( QuotedChar - “‘” )* - - ( ( QuotedChar - “‘” )* ’%>’ ) +RTAttributeValueSingle ::= ( ( QuotedChar - "'" )* - + ( ( QuotedChar - "'" )* '%>' ) ) - ( "%>’" | ) + ( "%>'" | ) [ vc: RTAttributeScriptingEnabled ] [ vc: ExpressionBodyContent ] @@ -1517,15 +1509,15 @@ Name ::= XML::Name Char ::= XML::Char -QuotedChar ::= ’'’ - | ’"’ - | ’\\’ - | ‘\”’ - | "\’" - | ‘\$’ - | ‘\#’ - | ( ‘${‘ ELExpressionBody ) - | ( ‘#{‘ ELExpressionBody ) +QuotedChar ::= ''' + | '"' + | '\\' + | '\"' + | "\'" + | '\$' + | '\#' + | ( '${' ELExpressionBody ) + | ( '#{' ELExpressionBody ) | Char [ vc: QuotedDollarMatched ] @@ -1538,57 +1530,56 @@ CDSect ::= XML::CDSect ===== Validity Constraints -The following validity constraints are -referenced in the above grammar using the syntax `[ vc: -ValidityConstraint ]` , and must be followed: +The following validity constraints are referenced in the above grammar +using the syntax `[vc: ValidityConstraint]`, and must be followed: -* `ScriptingEnabled` - The `ScriptlessBody` +* `ScriptingEnabled` - The `ScriptlessBody` production must be followed if scripting is disabled for this translation unit. See the `scripting-invalid` JSP Configuration element -(#77067[]). -* `ScriptlessBody` - The `AllBody` +(<<_Disabling_Scripting_Elements>>). +* `ScriptlessBody` - The `AllBody` production cannot be followed if one of our parent nodes in the parse tree is a `ScriptlessBody` production. That is, once we have followed the `ScriptlessBody` production, until that production is complete we cannot choose the `AllBody` production. -* `ELEnabled` - The token `${` or `#{` is +* `ELEnabled` - The token `${` or `#{` is not followed if expressions are disabled for this translation unit. See the `isELIgnored` page and tag directive -(See <>) and -/C:/jspspec/JSP`Tag`Files.html#79361[] respectively) and the `el-ignored` -JSP Configuration element (#57050[]). -* `TagFileSpecificDirectives` - The +(See <>) and +<> respectively) and the `el-ignored` +JSP Configuration element (<<_Deactivating_EL_Evaluation>>). +* `TagFileSpecificDirectives` - The `JSPDirectiveBody` production must be followed if the root production is `JSPPage` (i.e. this is a JSP page). The `TagDefDirectiveBody` production must be followed if the root production is `JSPTagDef` (i.e. this is a tag file). -* `TagFileSpecificXMLDirectives` - The +* `TagFileSpecificXMLDirectives` - The `XMLJSPDirectiveBody` production must be followed if the root production is `JSPPage` (i.e. this is a JSP page). The `XMLTagDefDirectiveBody` production must be followed if the root production is `JSPTagDef` (i.e. this is a tag file). -* `PageDirectiveUniqueAttr` - A translation +* `PageDirectiveUniqueAttr` - A translation error will result if there is more than one occurrence of any attribute defined by this directive in a given translation unit, and if the value of the attribute is different than the previous occurrence. No translation error results if the value is identical to the previous occurrence. In addition, the `import` and `pageEncoding` attributes are -excluded from this constraint (see <>). -* `TagLibDirectiveUniquePrefix` - A +excluded from this constraint (see <>). +* `TagLibDirectiveUniquePrefix` - A translation error will result if the prefix `AttributeValue` has already previously been encountered as a potential `TagPrefix` in this translation unit. -* `TagDirectiveUniqueAttr` - A translation +* `TagDirectiveUniqueAttr` - A translation error will result if the prefix of this tag directive is already defined in the current scope, and if that prefix is bound to a namespace other than that specified by the `uri` or `tagdir` attribute. -* `UniqueAttributeName` - A translation +* `UniqueAttributeName` - A translation error will result if there are two or more `attribute` directives with the same value for the `name` attribute in the same translation unit. A translation error will result if there is a `variable` directive with a `name-given` attribute equal to the value of the `name` attribute of an `attribute` directive in the same translation unit. -* `UniqueVariableName` - A translation error +* `UniqueVariableName` - A translation error must occur if more than one `variable` directive appears in the same translation unit with the same value for the `name-given` attribute or the same value for the `name-from-attribute` attribute. A translation @@ -1598,108 +1589,109 @@ directive in the same translation unit. A translation error must occur if there is a `variable` directive with a `name-from-attribute` attribute whose value is not equal to the `name` attribute of an `attribute` directive in the same translation unit that is also of type -`java.lang.String` , that is `required` and that is not an `rtexprvalue`. +`java.lang.String`, that is `required` and that is not an `rtexprvalue`. A translation error must occur if the value of the `alias` attribute is equal to the value of a `name-given` attribute of a `variable` directive, or the value of the `name` attribute of an `attribute` directive in the same translation unit. -* `TagFileSpecificActions` - The `invoke` +* `TagFileSpecificActions` - The `invoke` and `doBody` standard actions are only matched if the `JSPTagDef` production was followed (i.e. if this is a tag file instead of a JSP page). -* `RTAttributeScriptingEnabled` - If the +* `RTAttributeScriptingEnabled` - If the `RTAttributeValueDouble` or `RTAttributeValueSingle` productions are visited during parsing and scripting is disabled for this page, a translation error must be produced. See the `scripting-invalid` JSP -Configuration element (#77067[]). -* `ExpressionBodyContent` - A translation -error will result if the body content minus the closing delimiter ( `%>` -, or `` , depending on how the expression started) does +Configuration element (<<_Disabling_Scripting_Elements>>). +* `ExpressionBodyContent` - A translation +error will result if the body content minus the closing delimiter (`%>` +, or ``, depending on how the expression started) does not represent a well-formed expression in the scripting language selected for the JSP page. -* `StdActionAttributesValid` - An attribute +* `StdActionAttributesValid` - An attribute is considered “provided” for this standard action if either the `Attribute` production or the `AttributeBody` production is followed in the context of the enclosing `StandardAction` production. A translation error will result if any of the following conditions is true: -* The set of attributes “provided” for this +** The set of attributes “provided” for this standard action does not match one of the valid attribute combinations specified in <<_Valid_Body_Content_And_Attributes_For_Standard_Actions>>. -* The same attribute is “provided” more than +** The same attribute is “provided” more than once, as determined by the attribute name. -* An attribute is “provided” using the +** An attribute is “provided” using the AttributeBody production that does not accept a request-time expression value, as indicated by the = prefix in <<_Valid_Body_Content_And_Attributes_For_Standard_Actions>>. -* `StdActionBodyMatch` - The `StdActionBody` +* `StdActionBodyMatch` - The `StdActionBody` production will only be matched if the production listed for this standard action in the “Body Production” column in <<_Valid_Body_Content_And_Attributes_For_Standard_Actions>> is followed. -* `AttributeBodyMatch` - The type of element +* `AttributeBodyMatch` - The type of element being specified determines which production is followed (see -StandardActions.html#29033[]for details): -* If a custom action that specifies an +<> for details): +** If a custom action that specifies an attribute of type `JspFragment`, `ScriptlessBody` must be followed. -* If a standard or custom action that accepts +** If a standard or custom action that accepts a request-time expression value, `AllJspBody` must be followed. -* If a standard or custom action that does +** If a standard or custom action that does not accept a request-time expression value, `TemplateTextBody` must be followed. -* `JspBodyBodyContent` - The +* `JspBodyBodyContent` - The `ScriptlessBody` production must be followed if the body content for -this tag is `scriptless` . The `Body` production must be followed if the +this tag is `scriptless`. The `Body` production must be followed if the body content for this tag is `JSP`. The TagDependentBody production -must be followed if the body content for this tag is `tagdependent` . -* `UniqueAttSpec` - A translation error will +must be followed if the body content for this tag is `tagdependent`. +* `UniqueAttSpec` - A translation error will result if the same attribute name appears more than once. -* `CustomActionMatchesAndValid` - Following -the rules in /C:/jspspec/JSP`Tag`Extensions.html#45090[] for determining +* `CustomActionMatchesAndValid` - Following +the rules in <> for determining the relevant set of tags and tag libraries, assume the following: -* Let `U` be the URI indicated by the `uri` +** Let `U` be the URI indicated by the `uri` `AttributeValue` of the previously encountered `TagLibDirectiveAttrList` with `prefix` matching the `TagPrefix` for this potential custom action, or `nil` if no such `TagLibDirectiveAttrList` was encountered in this translation unit. -* If `U` is not `nil` , let `L` be the +** If `U` is not `nil`, let `L` be the `` element in the relevant TLD entry such that `L.uri` is equal -to `U` . +to `U`. -Then: +[none] +* Then: -* If, after being parsed, the `CustomAction` +** If, after being parsed, the `CustomAction` production is matched (not yet taking into account the following rules), `TagPrefix` is considered a potential `TagPrefix` in this translation unit for the purposes of the `TagLibDirectiveUniquePrefix` validity constraint. -* The `CustomAction` production will not be +** The `CustomAction` production will not be matched if `U` is `nil` or if the `TagPrefix` does not match the `prefix` `AttributeValue` of a `TagLibDirectiveAttrList` previously encountered in this translation unit. -* Otherwise, if the `CustomAction` production +** Otherwise, if the `CustomAction` production is matched, a translation error will result if there does not exist a `` element `T` in a relevant TLD such that `L.T.name` is equal to `CustomActionName.` -* `CustomActionTagDependentMatch` - Assume +* `CustomActionTagDependentMatch` - Assume the definition of `L` from the `CustomActionMatchesAndValid` validity constraint above. The `CustomActionTagDependent` production is not matched if there does not exist a `` element `T` in a relevant TLD -such that `L.T.body-content` contains the value `tagdependent` . -* `CustomActionJSPContentMatch` - Assume the +such that `L.T.body-content` contains the value `tagdependent`. +* `CustomActionJSPContentMatch` - Assume the definition of `L` from the `CustomActionMatchesAndValid` validity constraint above. The `CustomActionJSPContent` production is not matched if there exists a `` element `T` in a relevant TLD such that -`L.T.body-content` does not contain the value `JSP` . -* `CustomActionScriptlessContentMatch` - +`L.T.body-content` does not contain the value `JSP`. +* `CustomActionScriptlessContentMatch` - Assume the definition of `L` from the `CustomActionMatchesAndValid` validity constraint above. The `CustomActionScriptlessContent` production is not matched if there does not exist a `` element `T` in a relevant TLD such that `L.T.body-content` contains the value -`scriptless` . -* `QuotedDollarMatch -` The ‘\$’ or ‘\#’ +`scriptless`. +* `QuotedDollarMatch -` The `\$` or `\#` token is only matched if EL is enabled for this translation unit. See -#57050[]. -* `ETagMatch` - Assume the definition of `U` +<<_Deactivating_EL_Evaluation>>. +* `ETagMatch` - Assume the definition of `U` from the `CustomActionMatchesAndValid` validity constraint. If -`TagPrefix` is not ‘ `jsp` ’ and `U` is `nil` , the `ETag` production is +`TagPrefix` is not ‘`jsp`’ and `U` is `nil`, the `ETag` production is not matched. Otherwise, the `ETag` production is matched and a translation error will result if the prefix and name of this closing tag does not match the prefix and name of the starting tag at the @@ -1711,7 +1703,7 @@ standard action. In the following example, assuming ‘my’ is a valid prefix and ‘indent’ is a valid tag, the `` tag is considered template text, and no translation error is produced: - + @@ -1720,11 +1712,11 @@ produce a translation error, assuming ‘my’ is a valid prefix and ‘indent’ is a valid tag, and regardless of whether ‘othertag’ is a valid tag or not. - + -* `ExtraClosingTagMatch` - The +* `ExtraClosingTagMatch` - The `ExtraClosingTag` production is not matched if encountered within two or more nested `Body` productions (e.g. if encountered inside the body of a standard or custom action). @@ -1778,9 +1770,10 @@ for this standard action invocation. |`jsp:plugin` |`PluginBody` -|`( !type, !code, !codebase, align, archive, -=height, hspace, jreversion, name, vspace, title, =width, nspluginurl, -iepluginurl, mayscript )` +|`( !type, !code, !codebase, align, archive,` + +`{nbsp} =height, hspace, jreversion, name, vspace,` + +`{nbsp} title, =width, nspluginurl, iepluginurl,` + +`{nbsp} mayscript )` |`jsp:invoke` |`EmptyBody` @@ -1800,10 +1793,10 @@ iepluginurl, mayscript )` |`jsp:output` |`EmptyBody` -|`( omit-xml-declaration ) + -( omit-xml-declaration, + -!doctype-root-element, + -!doctype-system, doctype-public )` +|`( omit-xml-declaration )` + +`( omit-xml-declaration,` + +`{nbsp} !doctype-root-element,` + +`{nbsp} !doctype-system, doctype-public )` |`jsp:param` |`EmptyBody` @@ -1839,7 +1832,13 @@ class, or in some other code (Java or other implementation programming language) called from the body of the JSP page implementation class. Runtime errors occurring are realized in the page implementation, using the Java programming language exception mechanism to signal their -occurrence to caller(s) of the offending behaviorlink:#a6611[1]. +occurrence to caller(s) of the offending behavior. + +NOTE: This is independent of scripting language. This specification +requires that unhandled errors occurring in a scripting language +environment used in a JSP container implementation to be signalled to the +JSP page implementation class via the Java programming language exception +mechanism. These exceptions may be caught and handled (as appropriate) in the body of the JSP page implementation class. @@ -1859,8 +1858,8 @@ prefix is reserved and used by the servlet and JSP specifications. ==== Using JSPs as Error Pages A JSP is considered an Error Page if it sets -the `page` directive’s `isErrorPage` attribute to `true` . If a page has -`isErrorPage` set to `true` , then the “exception” implicit scripting +the `page` directive’s `isErrorPage` attribute to `true`. If a page has +`isErrorPage` set to `true`, then the “exception” implicit scripting language variable (see <<_Implicit_Objects_Available_in_Error_Pages>>) of that page is initialized. The variable is set to the value of the `jakarta.servlet.error.exception request` attribute value if present, otherwise to the value of the @@ -1873,8 +1872,7 @@ defined by the Servlet specification, and made available through the `PageContext` to the page. This has the effect of providing easy access to the error information via the Expression Language. For example, an Error Page can access the status code using the syntax -`${pageContext.errorData.statusCode}` . See -/C:/jspspec/jakarta.servlet.jsp.html#91781[] for details. +`${pageContext.errorData.statusCode}`. See the Javadoc for details. By default, a JSP error page sets the status code of the response to the value of @@ -1958,8 +1956,8 @@ _Quoting in EL Expressions_ within EL expressions; use a literal `'${'` if the literal `${` is desired and expressions are enabled for the page (similarly, use a literal `'\#{'` if the literal `#{` is desired). For example, the -evaluation of `${'${'}` is `'${'` . Note that `${'}'}` is legal, and -simply evaluates to `'}'` . +evaluation of `${'${'}` is `'${'`. Note that `${'}'}` is legal, and +simply evaluates to `'}'`. _Quoting in Scripting Elements_ @@ -1969,8 +1967,8 @@ _Quoting in Template Text_ * A literal `<%` is quoted by `<\%` * Only when the EL is enabled for a page (see -\#57050[]), a literal `$` can be quoted -by `\$`, and a literal `#` can be quoted by `\#` . This is not required but +<<_Deactivating_EL_Evaluation>>), a literal `$` can be quoted +by `\$`, and a literal `#` can be quoted by `\#`. This is not required but is useful for quoting EL expressions. _Quoting in Attributes_ @@ -1981,14 +1979,14 @@ expression. Quoting can be used in attribute values regardless of whether they are delimited using single or double quotes. It is only required as described below. -* A `‘` is quoted as `\’` . This is required +* A `'` is quoted as `\'`. This is required within a single quote-delimited attribute value. -* A `“` is quoted as `\”` . This is required +* A `"` is quoted as `\"`. This is required within a double quote-delimited attribute value. * A `\` is quoted as `\\` * Only when the EL is enabled for a page (see -\#57050[]), a literal `$` can be quoted -by `\$` . Similarly, a literal `#` can be quoted by `\#` . This is not +<<_Deactivating_EL_Evaluation>>), a literal `$` can be quoted +by `\$`. Similarly, a literal `#` can be quoted by `\#`. This is not required but is useful for quoting EL expressions. * A `%>` is quoted as `%\>` * A `<%` is quoted as `<\%` @@ -2004,7 +2002,7 @@ values. The following line shows a legal scriptlet, but perhaps with an unintended value. The result is `Joe said %\>` not -`Joe said %>` . +`Joe said %>`. <%= "Joe said %\\>" %> @@ -2014,10 +2012,11 @@ The next lines are all legal quotations. <%= "Joe said %\>" %> - <% String joes`statement = "hi!"; %> + - <%= "Joe said \"" + joes`statement + "\"." %> + - - +---- +<% String joes`statement = "hi!"; %> + <%= "Joe said \"" + joes`statement + "\"." %> + +---- " /> @@ -2026,53 +2025,56 @@ The next lines are all legal quotations. "/> - "/> + "/> - <% String s="abc"; %> - " /> - ' /> +---- +<% String s="abc"; %> + " /> + ' /> +---- _XML Documents_ The quoting conventions are different from -those of XML. See JSPDocuments.html#64789[]. +those of XML. See <>. === Overall Semantics of a JSP Page A JSP page implementation class defines a `_jspService()` method mapping from the request to the response object. Some details of this transformation are specific to the scripting -language used (see /C:/jspspec/JSP`Scripting.html#68206[]). Most details +language used (see <>). Most details are not language specific and are described in this chapter. The content of a JSP page is devoted largely to describing the data that is written into the output stream of the response. (The JSP container usually sends this data back to the client.) The description is based on a `JspWriter` object that is -exposed through the implicit object `out` (see <>). Its value varies: +exposed through the implicit object `out` (see <>). +Its value varies: * Initially, `out` is a new `JspWriter` object. This object may be different from the stream object returned -from `response.getWriter()` , and may be considered to be interposed on -the latter in order to implement buffering (see <>). This is the +from `response.getWriter()`, and may be considered to be interposed on +the latter in order to implement buffering (see <>). +This is the initial `out` object. JSP page authors are prohibited from writing directly to either the `PrintWriter` or `OutputStream` associated with -the `ServletResponse` . +the `ServletResponse`. * The JSP container should not invoke `response.getWriter()` until the time when the first portion of the content is to be sent to the client. This enables a number of uses of JSP, including using JSP as a language to “glue” actions that deliver binary content, or reliably forwarding to a servlet, or change dynamically the content type of the response before generating content. -See /C:/jspspec/JSP`I18N.html#77284[]. +See <>. * Within the body of some actions, `out` may be temporarily re-assigned to a different (nested) instance of a `JspWriter` object. Whether this is the case depends on the details of the action’s semantics. Typically the content of these temporary streams -is appended to the stream previously referred to by `out` , and `out` is +is appended to the stream previously referred to by `out`, and `out` is subsequently re-assigned to refer to the previous (nesting) stream. Such nested streams are always buffered, and require explicit flushing to a nesting stream or their contents will be discarded. @@ -2086,10 +2088,10 @@ written to it will be passed directly through to the `ServletResponse` output stream. A JSP page can also describe what should -happen when some specific events occur. In JSP 2.2, the only events that +happen when some specific events occur. In JSP 3.0, the only events that can be described are the initialization and the destruction of the page. These events are described using “well-known method names” in -declaration elements. (See /C:/jspspec/JSP`Engine.html#15380[]). +declaration elements. (See <>). === Objects @@ -2124,8 +2126,8 @@ the JavaScript™ programming language. The exact rules for the visibility of the variables are scripting language specific. -link:JSP`Syntax.html#UNKNOWN[See .] defines the rules for when the -`language` attribute of the `page` directive is `java` . +<> defines the rules for when the +`language` attribute of the `page` directive is `java`. ==== Objects and Scopes @@ -2148,26 +2150,26 @@ Objects are created within a JSP page instance that is responding to a request object. There are several scopes: -* `page` - Objects with `page` scope are +* `page` - Objects with `page` scope are accessible only within the page where they are created. All references to such an object shall be released after the response is sent back to the client from the JSP page or the request is forwarded somewhere else. References to objects with `page` scope are stored in the `pageContext` object. -* `request` - Objects with `request` scope +* `request` - Objects with `request` scope are accessible from pages processing the same request where they were created. References to the object shall be released after the request is processed. In particular, if the request is forwarded to a resource in the same runtime, the object is still reachable. References to objects with `request` scope are stored in the `request` object. -* `session` - Objects with `session` scope +* `session` - Objects with `session` scope are accessible from pages processing requests that are in the same session as the one in which they were created. It is not legal to define an object with session scope from within a page that is not -session-aware (see <>). All references to the object shall be released after the +session-aware (see <>). All references to the object shall be released after the associated session ends. References to objects with `session` scope are stored in the `session` object associated with the page activation. -* `application` - Objects with `application` +* `application` - Objects with `application` scope are accessible from pages processing requests that are in the same application as they one in which they were created. Objects with application scope can be defined (and reached) from pages that are not @@ -2175,7 +2177,7 @@ session-aware. References to objects with `application` scope are stored in the `application` object associated with a page activation. The `application` object is the servlet context obtained from the servlet configuration object. All references to the object shall be released -when the runtime environment reclaims the `ServletContext` . +when the runtime environment reclaims the `ServletContext`. A `name` should refer to a unique object at all points in the execution; that is, all the different scopes really @@ -2189,7 +2191,7 @@ implicit objects that are always available for use within scriptlets and scriptlet expressions through scripting variables that are declared implicitly at the beginning of the page. All scripting languages are required to provide access to these objects. See -/C:/jspspec/JSP`Expression`Language.html#77288[] for the implicit objects +<<_Implicit_Objects>> for the implicit objects available within EL expressions. Implicit objects are available to tag handlers through the pageContext object, see below. @@ -2199,7 +2201,7 @@ shown in <<_Implicit_Objects_Available_in_JSP_Pages>>. [[_Implicit_Objects_Available_in_JSP_Pages]] .Implicit Objects Available in JSP Pages -[cols="20,20,60",options="header"] +[cols="20,40,40",options="header"] |=== |Variable Name @@ -2239,7 +2241,7 @@ protocols. + |`jakarta.servlet.ServletContext` |The servlet context obtained from the servlet configuration object (as in the call -`getServletConfig().getContext()` ) + +`getServletConfig().getContext()`) + `application` scope |`out` @@ -2256,8 +2258,11 @@ configuration object (as in the call |`java.lang.Object` |The instance of this page’s implementation class processing the current -requestlink:#a6612[2] + +request + `page` scope +_When the scripting +language is `java` then `page` is a synonym for `this` in the body of +the page_ + |=== @@ -2267,7 +2272,7 @@ can be accessed in an error page, as described in [[_Implicit_Objects_Available_in_Error_Pages]] .Implicit Objects Available in Error Pages -[cols="20,20,60",options="header"] +[cols="20,40,40",options="header"] |=== |Variable Name @@ -2282,12 +2287,12 @@ error page being invoked. + |=== -Object names with prefixes `jsp` , ``jsp` , -`jspx` and ``jspx` , in any combination of upper and lower case, are +Object names with prefixes `jsp`, `jsp`, +`jspx` and `jspx`, in any combination of upper and lower case, are reserved by the JSP specification. See -/C:/jspspec/JSP`Tag`Extensions.html#40979[] for some non-normative +<> for some non-normative conventions for the introduction of new implicit objects. ==== The pageContext Object @@ -2300,8 +2305,7 @@ in any compliant JSP container while taking advantage of implementation-specific improvements like high performance `JspWriters` . -See /C:/jspspec/jakarta.servlet.jsp.html#91781[] -for more details. +See the `jakarta.servlet.jsp` Javadocs for more details. === Template Text Semantics @@ -2315,13 +2319,13 @@ Text is very simple: the template text is passed through to the current Directives are messages to the JSP container. Directives have this syntax: - <%@ directive { attr=”value” }* %> + <%@ directive { attr="value" }* %> There may be optional white space after the -`<%@` and before `%>` . +`<%@` and before `%>`. This syntax is easy to type and concise but -it is not XML-compatible. JSPDocuments.html#64789[] +it is not XML-compatible. <> describes equivalent alternative mechanisms that are consistent with XML syntax. @@ -2330,7 +2334,7 @@ current `out` stream. There are three directives: the `page` and the `taglib` directives are described next, while the `include` -directive is described in <>. +directive is described in <>. ==== The `page` Directive @@ -2338,7 +2342,7 @@ The `page` directive defines a number of page dependent properties and communicates these to the JSP container. This `` element -(JSPDocuments.html#16408[]) describes the same information +(<>) describes the same information following the XML syntax. A translation unit (JSP source file and any @@ -2348,7 +2352,7 @@ complete translation unit (i.e. page directives are position independent). An exception to this position independence is the use of the `pageEncoding` and `contentType` attributes in the determination of the page character encoding; for this purpose, they should appear at the -beginning of the page (see /C:/jspspec/JSP`I18N.html#41392[]). There +beginning of the page (see <>). There shall be only one occurrence of any attribute/value pair defined by this directive in a given translation unit, unless the values for the duplicate attributes are identical for all occurrences. The `import` and @@ -2371,19 +2375,19 @@ _Examples_ The following directive provides some user-visible information on this JSP page: - <%@ page info=”my latest JSP Example” %> + <%@ page info="my latest JSP Example" %> The following directive requests no buffering, and provides an error page. - <%@ page buffer=”none” errorPage=”/oops.jsp” %> + <%@ page buffer="none" errorPage="/oops.jsp" %> The following directive indicates that the scripting language is based on Java, that the types declared in the package `com.myco` are directly available to the scripting code, and that a buffering of 16KB should be used. - <%@ page language=”java” import=”com.myco.*” buffer=”16kb” %> + <%@ page language="java" import="com.myco.*" buffer="16kb” %> _Syntax_ @@ -2420,7 +2424,7 @@ The details of the attributes are as follows: the scriptlets, expression scriptlets, and declarations within the body of the translation unit (the JSP page and any files included using the `include` directive below). + -In JSP 2.2, the only defined and required +In JSP 3.0, the only defined and required scripting language value for this attribute is `java` (all lowercase, case-sensitive). + This specification only describes the @@ -2430,7 +2434,7 @@ When `java` is the value of the scripting language, the Java Programming Language source code fragments used within the translation unit are required to conform to the Java Programming Language Specification in the way indicated in -/C:/jspspec/JSP`Scripting.html#68206[]. + +<>. + All scripting languages must provide some implicit objects that a JSP page author can use in declarations, scriptlets, and expressions. The specific objects that can be used are @@ -2445,17 +2449,16 @@ are reserved. + It is a fatal translation error for a directive with a non- `java` language attribute to appear after the first scripting element has been encountered. + -Default is `java` . +Default is `java`. |`extends` |The value is a fully qualified Java programming language class name, that names the superclass of the class -to which this JSP page is transformed (see -/C:/jspspec/JSP`Engine.html#57518[]). + +to which this JSP page is transformed (see <>). + This attribute should not be used without careful consideration as it restricts the ability of the JSP container to provide specialized superclasses that may improve on the quality of -rendered service. See /C:/jspspec/JSP`Tag`Extensions.html#40979[] for an +rendered service. See <> for an alternate way to introduce objects into a JSP page that does not have this drawback. @@ -2486,12 +2489,12 @@ If `false` then the page does not participate in a session; the `session` implicit variable is unavailable, and any reference to it within the body of the JSP page is illegal and shall result in a fatal translation error. + -Default is `true` . +Default is `true`. |`buffer` |Specifies the buffering model for the initial `out` `JspWriter` to handle content output from the page. + -If `none` , then there is no buffering and +If `none`, then there is no buffering and all output is written directly through to the `ServletResponse` `PrintWriter`. + The size can only be specified in kilobytes. @@ -2508,17 +2511,18 @@ is buffer (see <>). |`autoFlush` |Specifies whether the buffered output should -be flushed automatically ( `true` value) when the buffer is filled, or -whether an exception should be raised ( `false` value) to indicate +be flushed automatically (`true` value) when the buffer is filled, or +whether an exception should be raised (`false` value) to indicate buffer overflow. It is illegal, resulting in a translation error, to set -`autoFlush` to `false` when `buffer=none` . The default value is `true`. +`autoFlush` to `false` when `buffer=none`. The default value is `true`. |`isThreadSafe` -|Note: The Servlet 2.4 specification -deprecates SingleThreadModel, which is the most common mechanism for JSP +a|NOTE: The Servlet 2.4 specification +deprecated `SingleThreadModel`, which is the most common mechanism for JSP containers to implement isThreadSafe. Page authors are advised against using isThreadSafe, as the generated Servlet may contain deprecated -code. + +code. + Indicates the level of thread safety implemented in the page. + If `false` then the JSP container shall @@ -2533,7 +2537,7 @@ Default is `true`. + Note that even if the `isThreadSafe` attribute is `false` the JSP page author must ensure that accesses to any shared objects are properly synchronized., The objects may be shared -in either the `ServletContext` or the `HttpSession` . +in either the `ServletContext` or the `HttpSession`. |`info` |Defines an arbitrary string that is @@ -2543,7 +2547,7 @@ from the page’s implementation of `Servlet.getServletInfo` method. |`isErrorPage` |Indicates if the current JSP page is intended to be the URL target of another JSP page’s `errorPage`. + -If `true` , then the implicit script language +If `true`, then the implicit script language variable `exception` is defined and its value is a reference to the offending Throwable from the source JSP page in error. + If `false` then the `exception` implicit @@ -2582,29 +2586,29 @@ If the page defines an error page via the |Defines the MIME type and the character encoding for the response of the JSP page, and is also used in determining the character encoding of the JSP page. + -Values are either of the form “ `TYPE` ” or “ -`TYPE;charset=CHARSET` ”with an optional white space after the “ `;` ”. -“ `TYPE` ” is a MIME type, see the IANA registry at +Values are either of the form “`TYPE`” or “`TYPE;charset=CHARSET`” with an +optional white space after the “`;`”. +“`TYPE`” is a MIME type, see the IANA registry at `http://www.iana.org/assignments/media-types/index.html` for useful -values. “ `CHARSET` ”, if present, must be the IANA name for a character +values. “`CHARSET`”, if present, must be the IANA name for a character encoding. + -The default value for “ `TYPE` ” is “ -`text/html` ” for JSP pages in standard syntax, or “ `text/xml` ” for -JSP documents in XML syntax. If “ `CHARSET` ” is not specified, the +The default value for “`TYPE`” is “`text/html`” for JSP pages in standard +syntax, or “`text/xml`” for +JSP documents in XML syntax. If “`CHARSET`” is not specified, the response character encoding is determined as described in -/C:/jspspec/JSP`I18N.html#52032[]. + +<>. + The corresponding JSP configuration element -is default-content-type (see <>). See /C:/jspspec/JSP`I18N.html#77284[] for complete details on +is default-content-type (see <>). See +<> for complete details on character encodings. |`pageEncoding` |Describes the character encoding for the JSP -page. The value is of the form “ `CHARSET` ”, which must be the IANA +page. The value is of the form “`CHARSET`”, which must be the IANA name for a character encoding. For JSP pages in standard syntax, the character encoding for the JSP page is the charset given by the `pageEncoding` attriute if it is present, otherwise the charset given by -the `contentType` attribute if it is present, otherwise “ `ISO-8859-1` -”. + +the `contentType` attribute if it is present, otherwise “`ISO-8859-1`”. + For JSP documents in XML syntax, the character encoding for the JSP page is determined as described in section 4.3.3 and appendix F.1 of the XML specification. The @@ -2612,20 +2616,20 @@ section 4.3.3 and appendix F.1 of the XML specification. The translation-time error if a document names different encodings in its XML prolog / text declaration and in the `pageEncoding` attribute. The corresponding JSP configuration element is `page-encoding` (see -#29469[]). + -See /C:/jspspec/JSP`I18N.html#77284[] for +<>). + +See <> for complete details on character encodings. |`isELIgnored` |Defines whether EL expressions are ignored or -recognized for this page and translation unit. If `true` , EL -expressions (of the form `${...}` and `\#{...}` ) are ignored by the -container. If `false` , EL expressions (of the form `${...}` and -`#{...}` ) are recognized when they appear in template text or action +recognized for this page and translation unit. If `true`, EL +expressions (of the form `${\...}` and `\#{\...}`) are ignored by the +container. If `false`, EL expressions (of the form `${\...}` and +`#{\...}`) are recognized when they appear in template text or action attributes. The corresponding JSP configuration element is `el-ignored` -(see #57050[]). The default value +(see <<_Deactivating_EL_Evaluation>>). The default value varies depending on the `web.xml` version - see -/C:/jspspec/JSP`Expression`Language.html#64032[]. +<>. |`deferredSyntaxAllowedAsLiteral` |Indicates if the character sequence #{ is @@ -2635,7 +2639,7 @@ occurs when the character sequence is used as a String literal. The corresponding JSP configuration element is `deferred-syntax-allowed-as-literal` (see #52904[]). See -/C:/jspspec/JSP`Preface.html#49688[] for more information. +<> for more information. |`trimDirectiveWhitespaces` |Indicates how whitespaces in template text @@ -2644,7 +2648,7 @@ is removed from the output. The default is not to trim whitespaces. This attribute is useful to remove the extraneous whitespaces from the end of a directive that is not followed by template text. The corresponding JSP configuration element is `trim-directive-whitespaces` (see -#70753[]). The attribute is ignored by +<>). The attribute is ignored by JSP documents (XML syntax). |=== @@ -2671,12 +2675,10 @@ A tag library may include a validation method that will be consulted to determine if a JSP page is correctly using the tag library functionality. -See -/C:/jspspec/JSP`Tag`Extensions.html#43756[] for more specification -details. And see /C:/jspspec/JSP`Tag`Extensions.html#64303[] for an -implementation note. +See <> for more specification details. And see +<> for an implementation note. -JSPDocuments.html#80254[] +<> describes how the functionality of this directive can be exposed using XML syntax. @@ -2688,8 +2690,8 @@ other tag libraries should be introduced in this page using this prefix. In this particular case, we assume the tag library includes a `doMagic` element type, which is used within the page. - <%@ taglib uri=”http://www.mycorp/supertags” - prefix=”super” %> + <%@ taglib uri="http://www.mycorp/supertags" + prefix="super" %> ... ... @@ -2697,7 +2699,7 @@ element type, which is used within the page. _Syntax_ - <%@ taglib ( uri=”tagLibraryURI” | tagdir=”tagDir” ) prefix=”tagPrefix” %> + <%@ taglib ( uri="tagLibraryURI" | tagdir="tagDir" ) prefix="tagPrefix" %> where the attributes are: @@ -2710,15 +2712,14 @@ where the attributes are: specification that uniquely identifies the tag library descriptor associated with this prefix. + The URI is used to locate a description of -the tag library as indicated in -/C:/jspspec/JSP`Tag`Extensions.html#43756[]. +the tag library as indicated in <>. |`tagdir` |Indicates this prefix is to be used to identify tag extensions installed in the `/WEB-INF/tags/` directory or a subdirectory. An implicit tag library descriptor is used (see -/C:/jspspec/JSP`Tag`Files.html#21695[] for details). A translation error -must occur if the value does not start with `/WEB-INF/tags` . A +<> for details). A translation error +must occur if the value does not start with `/WEB-INF/tags`. A translation error must occur if the value does not point to a directory that exists. A translation error must occur if used in conjunction with the `uri` attribute. @@ -2727,8 +2728,8 @@ the `uri` attribute. |Defines the prefix string in `:` that is used to distinguish a custom action, e.g ``. + -Prefixes starting with `jsp:` , `jspx:` , -`java:` , `jakarta:` and `servlet:` are reserved. + +Prefixes starting with `jsp:`, `jspx:`, +`java:`, `jakarta:` and `servlet:` are reserved. + A prefix must follow the naming convention specified in the XML namespaces specification. + Empty prefixes are illegal in this version of @@ -2746,7 +2747,7 @@ not recognized by the corresponding tag library. The `include` directive is used to substitute text and/or code at JSP page translation-time. The `<%@ include -file=”relativeURLspec” %>` directive inserts the text of the specified +file="relativeURLspec" %>` directive inserts the text of the specified resource into the page or tag file. The included file is subject to the access control available to the JSP container. The `file` attribute is as in <>. @@ -2759,12 +2760,11 @@ for mixed syntax includes are described in A JSP container can include a mechanism for being notified if an included file changes, so the container can -recompile the JSP page. However, the JSP 2.2 specification does not have +recompile the JSP page. However, the JSP 3.0 specification does not have a way of directing the JSP container that included files have changed. -The `` element -(JSPDocuments.html#41999[]) describes the same information -following the XML syntax. +The `` element (<>) +describes the same information following the XML syntax. _Examples_ @@ -2772,7 +2772,7 @@ The following example requests the inclusion, at translation time, of a copyright file. The file may have elements which will be processed too. - <%@ include file=”copyright.html” %> + <%@ include file="copyright.html" %> _Syntax_ @@ -2785,8 +2785,8 @@ directives that activate the use of tag libraries within the page. In some cases, these are the only tag libraries that are supposed to be used by the JSP page authors. These, and other common conventions are greately facilitated by two JSP configuration elements: -`include-prelude` and `include-coda` . A full description of the -mechanism is in #41204[]. +`include-prelude` and `include-coda`. A full description of the +mechanism is in <>. With respect to the standard and XML syntaxes, just as with the `include` directive, implicit includes can @@ -2797,13 +2797,13 @@ The semantics for mixed syntax includes are described in ==== Including Data in JSP Pages Including data is a significant part of the -tasks in a JSP page. Accordingly, the JSP 2.2 specification has two +tasks in a JSP page. Accordingly, the JSP 3.0 specification has two include mechanisms suited to different tasks. A summary of their -semantics is shown in <<_Summary_of_Include_Mechanisms_in_JSP_2.2>>. +semantics is shown in <<_Summary_of_Include_Mechanisms_in_JSP_3.0>>. -[[_Summary_of_Include_Mechanisms_in_JSP_2.2]] -.Summary of Include Mechanisms in JSP 2.2 -[cols="5*",options="header"] +[[_Summary_of_Include_Mechanisms_in_JSP_3.0]] +.Summary of Include Mechanisms in JSP 3.0 +[cols="25,15,15,25,20",options="header"] |=== |Syntax @@ -2814,11 +2814,11 @@ semantics is shown in <<_Summary_of_Include_Mechanisms_in_JSP_2.2>>. 5+^|*Include Directive - Translation-time* -|`<%@ include file=... %>` +|`<%@ include file=\... %>` |file-relative |static |Content is parsed by JSP container. -|JSP.1.10.3 - link +|<> 5+^|*Include Action - Request-time* @@ -2826,7 +2826,7 @@ semantics is shown in <<_Summary_of_Include_Mechanisms_in_JSP_2.2>>. |page-relative |static and dynamic |Content is not parsed; it is included in place. -|JSP.5.4 - link +|<> |=== @@ -2846,7 +2846,7 @@ of processing it is included. Implicit include directives can also be requested for a collection of pages through the use of the `` and `` elements of the JSP -configuration section of `web.xml` . +configuration section of `web.xml`. For translation-time includes, included content can use either the same syntax as the including page, or a @@ -2876,26 +2876,26 @@ defined in the current scope (by a JSP segment in either syntax), a translation error must occur unless that prefix is being redefined to the same namespace URI. -See /C:/jspspec/JSP`XML`Views.html#14490[] for +See <> for examples of how these semantics are applied to actual JSP pages and documents. ==== Additional Directives for Tag Files Additional directives are available when -editing a tag file. See /C:/jspspec/JSP`Tag`Files.html#62326[] for +editing a tag file. See <> for details. === EL Elements EL expressions can appear in template data and in attribute values. EL expressions are defined in more detail in -/C:/jspspec/JSP`Expression`Language.html#98642[]. +<>. EL expressions can be disabled through the use of JSP configuration elements and page directives; see -<> and -#57050[]. +<> and +<<_Deactivating_EL_Evaluation>>. EL expressions, when not disabled, can be used anywhere within template data. @@ -2904,8 +2904,7 @@ EL expressions can be used in any attribute of a standard action that this specification indicates can accept a run-time expression value, and in any attribute of a custom action that has been indicated to accept run-time expressions (i.e. their associated -`` in the TLD is `true` ; see -/C:/jspspec/JSP`TLD.html#29000[]). +`` in the TLD is `true` ; see the XML schema for TLDs). === Scripting Elements @@ -2913,17 +2912,18 @@ Scripting elements are commonly used to manipulate objects and to perform computation that affects the content generated. -JSP 2.0 adds EL expressions as an alternative +JSP 2.0 added EL expressions as an alternative to scripting elements. These are described in more detail in -/C:/jspspec/JSP`Expression`Language.html#98642[]. Note that scripting +<>. Note that scripting elements can be disabled through the use of the `scripting-invalid` element in the web.xml deployment descriptor (see -#77067[]). +<<_Disabling_Scripting_Elements>>). There are three other classes of scripting elements: declarations, scriptlets and expressions. The scripting language used in the current page is given by the value of the -`language` directive (see <>). In JSP 2.2, the only value defined is `java` . +`language` directive (see <>). In JSP 3.0, the only +value defined is `java`. Declarations are used to declare scripting language constructs that are available to all other scripting elements. @@ -2945,7 +2945,7 @@ scripting languages must support: The precise definition of the semantics for scripting done using elements based on the Java programming language is -given in /C:/jspspec/JSP`Scripting.html#68206[]. +given in <>. The semantics for other scripting languages are not precisely defined in this version of the specification, which @@ -2959,12 +2959,12 @@ syntax as follows: <% this is a scriptlet %> <%= this is an expression %> -White space is optional after `<%!` , `<%` , -and `<%=` , and before `%>` . +White space is optional after `<%!`, `<%`, +and `<%=`, and before `%>`. The equivalent XML elements for these scripting elements are described in -JSPDocuments.html#82973[]. +<<_Scripting_Elements>>. ==== Declarations @@ -2981,7 +2981,7 @@ page is initialized and are made available to other declarations, scriptlets, and expressions. The `` element -(JSPDocuments.html#82973[]) describes the same information +(<<_Scripting_Elements>>) describes the same information following the XML syntax. _Examples_ @@ -2996,7 +2996,7 @@ third declaration declares a method global to the page. <%! int i = 0; %> - <%! public String f(int i) { if (i<3) return(“...”); ... } %> + <%! public String f(int i) { if (i<3) return("..."); ... } %> _Syntax_ @@ -3008,7 +3008,7 @@ Scriptlets can contain any code fragments that are valid for the scripting language specified in the `language` attribute of the `page` directive. Whether the code fragment is legal depends on the details of the scripting language (see -/C:/jspspec/JSP`Scripting.html#68206[]). +<>). Scriptlets are executed at request-processing time. Whether or not they produce any output into the `out` stream @@ -3022,10 +3022,10 @@ specified scripting language. To use the `%>` character sequence as literal characters in a scriptlet, rather than to end the scriptlet, escape them -by typing `%\>` . +by typing `%\>`. The `` element -(JSPDocuments.html#82973[]) describes the same information +(<<_Scripting_Elements>>) describes the same information following the XML syntax. _Examples_ @@ -3056,7 +3056,7 @@ _Syntax_ An expression element in a JSP page is a scripting language expression that is evaluated and the result is -coerced to a `String` . The result is subsequently emitted into the +coerced to a `String`. The result is subsequently emitted into the current `out` `JspWriter` object. If the result of the expression cannot be @@ -3081,7 +3081,7 @@ processing time. The value of an expression is converted to a String and inserted at the proper position in the `.jsp` file. The `` element -(JSPDocuments.html#82973[]) describes the same information +(<<_Scripting_Elements>>) describes the same information following the XML syntax. _Examples_ @@ -3103,11 +3103,11 @@ of the specific request object received by the JSP page. The JSP specification includes some actions that are standard and must be implemented by all conforming JSP containers; these actions are described in -StandardActions.html#55184[]. +<>. New actions are defined according to the -mechanisms described in /C:/jspspec/JSP`Tag`Extensions.html#43756[] and -/C:/jspspec/jakarta.servlet.jsp.tagext.html#20465[] and are introduced +mechanisms described in <> and +the `jakarta.servlet.jsp.tagext` Javadoc and are introduced using the `taglib` directive. The syntax for action elements is based on @@ -3122,20 +3122,20 @@ may be applicable; the rules for them are described in <>. Many values are fixed translation-time -values, but JSP 2.2 also provides a mechanism for describing values that +values, but JSP 3.0 also provides a mechanism for describing values that are computed at request time, the rules are described in <>. ==== Request Time Attribute Values -An attribute value of the form `“<%= -scriptlet`expr %>”` or `‘<%= scriptlet`expr %>’` denotes a request-time +An attribute value of the form `"<%= +scriptlet_expr %>"` or `'<%= scriptlet_expr %>'` denotes a request-time attribute value. The value denoted is that of the scriptlet expression involved. If Expression Language evaluation is not deactivated for the -translation unit (see JSP#7050[]) then +translation unit (see <<_Deactivating_EL_Evaluation>>) then request-time attribute values can also be specified using the EL through the syntax `'${el_expr}'` or `"${el_expr}"` (as well as -`'\#{el_expr}'` or `"#{el_expr}"` ). Containers must also recognize +`'\#{el_expr}'` or `"#{el_expr}"`). Containers must also recognize multiple EL expressions mixed with optional string constants. For example, `"Version ${major}.${minor} Installed"` is a valid request-time attribute value. @@ -3164,28 +3164,28 @@ action element indicates whether a given attribute will accept request-time attribute values. Most attributes in the standard actions from -StandardActions.html#55184[] have page translation-time +<> have page translation-time semantics, but the following attributes accept request-time attribute expressions: * The `value` attribute of `jsp:setProperty` -(StandardActions.html#22442[]). +(<>). * The `beanName` attribute of `jsp:useBean` -(StandardActions.html#41392[]). +(<>). * The `page` attribute of `jsp:include` -(StandardActions.html#39949[]). +(<>). * The `page` attribute of `jsp:forward` -(StandardActions.html#23283[]). +(<>). * The `value` attribute of `jsp:param` -(StandardActions.html#80377[]). +(<>). * The `height` and `width` attributes of -`jsp:plugin` (StandardActions.html#18155[]). +`jsp:plugin` (<>). * The `name` attribute of `jsp:element` -(StandardActions.html#37936[]). +(<>). ==== Type Conversions -We describe two cases for type conversions +We describe two cases for type conversions. ===== Conversions from String values @@ -3197,7 +3197,7 @@ String values can be used to assign values to a type that has a `PropertyEditor` class as indicated in the JavaBeans specification. When that is the case, the `setAsText(String)` method is used. A conversion failure arises if the method throws an -`IllegalArgumentException` . +`IllegalArgumentException`. String values can also be used to assign to the types as listed in <<_Conversion_from_string_values_to_target_type>>. The conversion applied is that shown @@ -3218,7 +3218,7 @@ whether at translation time or request-time. |As converted by the corresponding PropertyEditor, if any, using PropertyEditor. `setAsText(string-literal) and PropertyEditor.getValue().` If there is no corresponding -`PropertyEditor` or the `PropertyEditor` throws an exception, ‘ `null` ’ +`PropertyEditor` or the `PropertyEditor` throws an exception, ‘`null`’ if the string is empty, otherwise error. |boolean or Boolean @@ -3255,8 +3255,8 @@ String is empty. `java.lang.Short.valueOf(String), or 0 if the string is empty.` |Object -|As if new `String(string-literal). This -results in new String( ““ ) if the string is empty.` +|As if new `String(string-literal)`. This +results in new String("") if the string is empty. |=== @@ -3271,7 +3271,7 @@ Library Descriptor. A given action may also define additional ways where type/value conversions are used. In particular, -StandardActions.html#22442[] describes the mechanism used +<> describes the mechanism used for the setProperty standard action. ===== Conversions from request-time expressions @@ -3279,30 +3279,17 @@ for the setProperty standard action. Request-time expressions can be assigned to properties of any type. In the case of scriptlet expressions, no automatic conversions will be performed. In the case of EL expressions, -the rules in /C:/elspec/language.html#39918[] of the EL specification +the rules in section 1.23, "Type Conversion" of the EL 4.0 specification document must be followed. - == Expression Language -As of JSP 2.1, the expression languages -of JSP 2.0 and JSF 1.1 have been merged into a single `unified` -expression language (EL 2.1) for the benefit of all Java based web-tier -technologies. - -While the expression language is still -defined within the JSP 2.1 specification, it however now has its own -independent specification document. This makes the intent clear that the -Expression Language is generally applicable to a variety of technologies -and does not carry a dependency on the JSP specification. Having the EL -defined in its own specification document will also make it easier in -the future should the decision be made to move it into its own JSR. -Please consult the EL specification document for details on the -Expression Language supported by JSP 2.1. +Please consult the Jakarta Expression Language 4.0 specification document +for details on the Expression Language supported by JSP 3.0. The addition of the EL to the JSP technology -facilitates much the writing of script-less JSP pages. These pages can +facilitates the writing of script-less JSP pages. These pages can use EL expressions but can’t use Java scriptlets, Java expressions, or Java declaration elements. This usage pattern can be enforced through the `scripting-invalid` JSP configuration element. @@ -3311,26 +3298,26 @@ The EL is available in attribute values for standard and custom actions and within template text. This chapter describes how the expression -language is integrated within the JSP 2.1 environment. +language is integrated within the JSP 3.0 environment. === Syntax of expressions in JSP pages: ${} vs #{} There are two constructs to represent EL -expressions: `${expr}` and `\#{expr}` . While the EL parses and +expressions: `${expr}` and `\#{expr}`. While the EL parses and evaluates `${}` and `#{}` the same way, additional restrictions are placed on the usage of these delimiters in JSP pages. An EL expression that is evaluated -immediately is represented in JSP with the syntax `${}` , while an EL +immediately is represented in JSP with the syntax `${}`, while an EL expression whose evaluation is deferred is represented with the syntax -`#{}` . +`#{}`. === Expressions and Template Text The EL can be used directly in template text, be it inside the body of a custom or standard actions or in template text outside of any action.Exceptions are if the body of the tag is -`tagdependent` , or if EL is turned off (usually for compatibility +`tagdependent`, or if EL is turned off (usually for compatibility issues) explicitly through a directive or implicitly; see below. Only the `${}` syntax is allowed for @@ -3348,7 +3335,7 @@ the current output. In cases where escaping is desired (for example, to help prevent cross-site scripting attacks), the JSTL core tag `` can be used. For example: - + The following shows a custom action where two EL expressions are used to access bean properties: @@ -3384,8 +3371,8 @@ category defined in the TLD. Details are provided in the sections below. ==== Static Attribute * Defined in the TLD through element -`` set to `false` . -* Type is always `java.lang.String` . +`` set to `false`. +* Type is always `java.lang.String`. * Value must be a String literal (since it is determined at translation time). It is illegal to specify an expression. * Type in the TLD is ignored. The String @@ -3396,58 +3383,58 @@ handler) using the conversions defined in ==== Dynamic Attribute * Defined in the TLD through element -`` set to `true` . +`` set to `true`. * If type is not specified in the TLD, -defaults to `java.lang.Object` . +defaults to `java.lang.Object`. * Value can be a String literal, a scriptlet expression, or an EL expression using the `${}` syntax. * An EL expression is parsed using `ExpressionFactory.createValueExpression() (` with an expected type equal to the type specified in the TLD) and the evaluation of the expression takes place immediately by calling method `getValue()` on the -`ValueExpression` . After evaluation of the expression, the value is +`ValueExpression`. After evaluation of the expression, the value is coerced to the expected type. The resulting value is passed in to the setter method for the tag attribute. ==== Deferred Value * Defined in the TLD through element -`` . +``. * If type is not specified in the TLD, -defaults to `java.lang.Object` . +defaults to `java.lang.Object`. * Value can be a String literal or an EL expression using the `#{}` syntax. * An EL expression is parsed using -`ExpressionFactory.createValueExpression() (` with an expected type +`ExpressionFactory.createValueExpression()` (with an expected type equal to the type specified in the TLD). The expression is not evaluated. The result of parsing the expression is passed directly to the setter method of the tag attribute, whose argument type must be j -`avax.el.ValueExpression` . This allows for deferred evaluation of EL +`avax.el.ValueExpression`. This allows for deferred evaluation of EL expressions. When the expression is evaluated by the tag handler, the value is coerced to the expected type. If a static value is provided, it is converted to a `ValueExpression` where `isLiteralText()` returns -`true` +`true`. ==== Deferred Method * Defined in the TLD through element -`` . +``. * If the method signature is not defined in -the TLD, it defaults to `void method()` . +the TLD, it defaults to `void method()`. * Value can be a String literal or an EL expression using the `#{}` syntax. * An EL expression is parsed using -`ExpressionFactory.createMethodExpression() (` with a method signature +`ExpressionFactory.createMethodExpression()` (with a method signature equal to the method signature specified in the TLD). The result of parsing the expression is passed directly to the setter method of the -tag attribute, whose argument type must be `jakarta.el.MethodExpression` . +tag attribute, whose argument type must be `jakarta.el.MethodExpression`. This allows for deferred processing of EL expressions that identify a method to be invoked on an Object. * A String literal can be provided, as long as the return type of the deferred method signature is not void. A `MethodExpression` is created, which when invoked, returns the String literal coerced to expected return type (the standard EL coercion rules -(see EL spec document /C:/elspec/language.html#39918[] apply). A +- see section 1.23, "Type Conversion" of the EL 4.0 specification) apply. A translation error occurs if the return type is void or if the string literal cannot be coerced to the return type of the deferred method signature. @@ -3458,13 +3445,13 @@ signature. `` (see <>) specified together with `` (see <>) or `` (see <>). * Value can be a String literal, a scriptlet -expression, or an EL expression using the `${}` or `#{}` syntax. The +expression, or an EL expression using the `${}` or `\#{}` syntax. The attribute value is considered a deferred value or a deferred method if the value is an EL expression using the `#{}` syntax. It is considered a dynamic attribute otherwise. * The attribute value is processed according to its type category as described above. The only difference is that the -setter method argument must be of type `java.lang.Object` . The setter +setter method argument must be of type `java.lang.Object`. The setter method will normally use `instanceof` to discriminate whether the attribute value is a dynamic attribute or a deferred value. @@ -3521,44 +3508,45 @@ Examples of Using ${} and #{} |=== +[[_Implicit_Objects]] === Implicit Objects There are several implicit objects that are available to EL expressions used in JSP pages. These objects are always available under these names: -* `pageContext` - the `PageContext` object -* `pageScope` - a `Map` that maps +* `pageContext` - the `PageContext` object +* `pageScope` - a `Map` that maps page-scoped attribute names to their values -* `requestScope` - a `Map` that maps +* `requestScope` - a `Map` that maps request-scoped attribute names to their values -* `sessionScope` - a `Map` that maps +* `sessionScope` - a `Map` that maps session-scoped attribute names to their values -* `applicationScope` - a `Map` that maps +* `applicationScope` - a `Map` that maps application-scoped attribute names to their values -* `param` `` - a `Map` that maps parameter -names to a single String parameter value (obtained by calling `` -`ServletRequest.getParameter(String name)` ) -* `paramValues` - a `Map` that maps +* `param` - a `Map` that maps parameter +names to a single String parameter value (obtained by calling +`ServletRequest.getParameter(String name)`) +* `paramValues` - a `Map` that maps parameter names to a `String[]` of all values for that parameter -(obtained by calling `ServletRequest.getParameterValues(String name)` ) -* `header` - a `Map` that maps header names +(obtained by calling `ServletRequest.getParameterValues(String name)`) +* `header` - a `Map` that maps header names to a single String header value (obtained by calling -`HttpServletRequest.getHeader(String name)` ) -* `headerValues` - a `Map` that maps header +`HttpServletRequest.getHeader(String name)`) +* `headerValues` - a `Map` that maps header names to a `String[]` of all values for that header (obtained by calling -`HttpervletRequest.getHeaders(String)` ) -* `cookie` - a `Map` that maps cookie names +`HttpervletRequest.getHeaders(String)`) +* `cookie` - a `Map` that maps cookie names to a single `Cookie` object. Cookies are retrieved according to the -semantics of `HttpServletRequest.getCookies()` . If the same name is +semantics of `HttpServletRequest.getCookies()`. If the same name is shared by multiple cookies, an implementation must use the first one encountered in the array of `Cookie` objects returned by the `getCookies()` method. However, users of the cookie implicit object must be aware that the ordering of cookies is currently unspecified in the servlet specification. -* `initParam` - a `Map` that maps context +* `initParam` - a `Map` that maps context initialization parameter names to their `String` parameter value -(obtained by calling `ServletContext.getInitParameter(String name)` ) +(obtained by calling `ServletContext.getInitParameter(String name)`) The following table shows some examples of using these implicit objects: @@ -3573,38 +3561,38 @@ Examples of Using Implicit Objects |`${pageContext.request.requestURI}` |The request's URI (obtained from -`HttpServletRequest` ) +`HttpServletRequest`) |`${sessionScope.profile}` |The session-scoped attribute named `profile` -(null if not found) +(`null` if not found) |`${param.productId}` |The `String` value of the `productId` -parameter, or null if not found +parameter, or `null` if not found |`${paramValues.productId}` |The `String[]` containing all values of the -`productId` parameter, or null if not found +`productId` parameter, or `null` if not found |=== === Deactivating EL Evaluation -Since the syntactic patterns `${` `expr` `}` -and `#{` `expr` `}` were not reserved in the JSP specifications before +Since the syntactic patterns `${ expr }` +and `#{ expr }` were not reserved in the JSP specifications before JSP 2.0, there may be situations where such patterns appear but the intention is not to activate EL expression evaluation but rather to pass through the pattern verbatim. To address this, the EL evaluation machinery can be deactivated as indicated in -#57050[]. +<<_Deactivating_EL_Evaluation>>. === Disabling Scripting Elements With the addition of the EL, some JSP page authors, or page authoring groups, may want to follow a methodology where scripting elements are not allowed. See -#77067[] for more details. +<<_Disabling_Scripting_Elements>> for more details. === Invalid EL expressions @@ -3628,54 +3616,53 @@ standard JSP machinery). === Resolution of Variables and their Properties The EL API provides a generalized mechanism, -an `ELResolver` , implemented by the JSP container and which defines the +an `ELResolver`, implemented by the JSP container and which defines the rules that govern the resolution of variables and object properties. The `ELResolver` shown in <<_JSP_Resolver_Hierarchy>> is passed to all EL expressions that appear in a JSP page or tag file. It is an instance of `jakarta.el.CompositeELResolver` that contains the following -component `ELResolver` s, in order: +component `ELResolver`s, in order: . `jsp.ImplicitObjectELResolver` + - + -Resolves the implicit objects mentioned in <>. -. All `ELResolver` s added via -`JspApplicationContext.addELResolver()` , in the same order in which +Resolves the implicit objects mentioned in <<_Implicit_Objects>>. ++ +. All `ELResolver`s added via +`JspApplicationContext.addELResolver()`, in the same order in which they were registered. + - + -This itself can take the form of a `el.CompositeELResolver` . This will +This itself can take the form of a `el.CompositeELResolver`. This will include the `ELResolver` registered by Faces. -. The ELresolver returned -by ExpressionFactory.getStreamELResolver(). -. jakarta.el.StaticFieldResolver -. `jakarta.el.MapELResolver` - constructed in ++ +. The `ELResolver` returned +by `ExpressionFactory.getStreamELResolver()`. +. `jakarta.el.StaticFieldResolver` +. `jakarta.el.MapELResolver` - constructed in read/write mode. -. jakarta.el.ResourceBundleELResolver -. `jakarta.el.ListELResolver` - constructed in +. `jakarta.el.ResourceBundleELResolver` +. `jakarta.el.ListELResolver` - constructed in read/write mode. -. `jakarta.el.ArrayELResolver` - constructed +. `jakarta.el.ArrayELResolver` - constructed in read/write mode. -. `jakarta.el.BeanELResolver` - constructed in +. `jakarta.el.BeanELResolver` - constructed in read/write mode. + - + Handles all cases where `base != null` -. `jsp.ScopedAttributeELResolver + -` + -Handles all cases where `base == null` . + ++ +. `jsp.ScopedAttributeELResolver` + +Handles all cases where `base == null`. + Provides a map for other identifiers by looking up its value as an attribute, according to the behavior of `PageContext.findAttribute(String)` on the `pageContext` object. For example: + + -${product} + +`${product}` + + -This expression will look for the attribute named `product` , searching +This expression will look for the attribute named `product`, searching the page, request, session, and application scopes, and will return its -value. If the attribute is not found, null is returned. +value. If the attribute is not found, `null` is returned. [[_JSP_Resolver_Hierarchy]] .JSP Resolver Hierarchy -image::sp-2.png[image] +image:sp-2.png[image] === Functions @@ -3701,23 +3688,23 @@ appear in attributes and directly in template text. The prefix `ns` must match the prefix of a tag library that contains a function whose name and signature matches -the function being invoked ( `f` ), or a translation error must occur. +the function being invoked (`f`), or a translation error must occur. If the prefix is omitted, the tag library associated with the default namespace is used (this is only possible in JSP documents). In the following standard syntax example, `func1` is associated with `some-taglib` : - <%@ taglib prefix=”some” uri=”http://acme.com/some-taglib” %> + <%@ taglib prefix="some" uri="http://acme.com/some-taglib" %> ${some:func1(true)} In the following JSP document example, both `func2` and `func3` are associated with `default-taglib` : - - + + ${func3(true)} @@ -3736,7 +3723,7 @@ packages). The specified method must be a public static method in the specified class, and must be specified using a fully-qualified return type followed by the method name, followed by the fully-qualified argument types in parenthesis, separated by commas (see the XML Schema -in /C:/jspspec/JSP`TLD.html#23570[] for a full description of this +for Tag Library Descriptors for a full description of this syntax). Failure to satisfy these requirements shall result in a translation-time error. @@ -3745,9 +3732,8 @@ element in the same tag library with the same value for their `name` element. If two functions have the same name, a translation-time error shall be generated. -Reference the `function` element in -/C:/jspspec/JSP`TLD.html#70854[] for how to specify a function in the -TLD. +Reference the `function` element in the XML Schema for Tag Library +Descriptors for how to specify a function in the TLD. ==== Example @@ -3778,7 +3764,7 @@ namespace is used. If the function has a prefix, assume the namespace as that associated with the prefix. * Let `ns` be the namespace associated with the function, and `f` be the name of the function. -* Locate the TLD associated with `ns` . If +* Locate the TLD associated with `ns`. If none can be found, this shall be a translation-time error. * Locate the `function` element with a `name` subelement with value `f` in that TLD. If none can be found, this shall @@ -3787,12 +3773,12 @@ be a translation-time error. the value of the `function-class` element. Locate the public static method with name and signature equal to the value of the `function-signature` element. If any of these don’t exist, a -translation-time error shall occur.. +translation-time error shall occur. * Evaluate each argument to the corresponding -type indicated in the signature +type indicated in the signature. * Evaluate the public static Java method. The resulting value is the value returned by the method evaluation, or -`null` if the Java method is declared to return `void` . If an exception +`null` if the Java method is declared to return `void`. If an exception is thrown during the method evaluation, the exception must be wrapped in an `ELException` and the `ELException` must be thrown. @@ -3800,11 +3786,10 @@ an `ELException` and the `ELException` must be thrown. This chapter describes the JSP configuration information, which is specified in the Web Application -Deployment Descriptor in `WEB-INF/web.xml` . As of Servlet 2.4, the Web +Deployment Descriptor in `WEB-INF/web.xml`. For Servlet 5.0, the Web Application Deployment Descriptor is defined using XML Schema, and -imports the elements described in (PENDING) -link:jsp.html#a3717[See XML Schema for JSP 2.0 Deployment -Descriptor.]. See that section for the details on how to specify JSP +imports the elements described in the XML Schema for JSP 3.0 Deployment +Descriptor. See the XML Schema for the details on how to specify JSP configuration information in a Web Application. === JSP Configuration Information in web.xml @@ -3815,9 +3800,9 @@ the JSP container. The information is described through the `jsp-config` element and its subelements. The `jsp-config` element is a subelement of -`web-app` `` that `` is used to provide global configuration information -for the JSP files in a Web Application. A `jsp-config` `` has two -subelements: `taglib` `` and `jsp-property-group` , defining the taglib +`web-app` that is used to provide global configuration information +for the JSP files in a Web Application. A `jsp-config` has two +subelements: `taglib` and `jsp-property-group`, defining the taglib mapping and groups of JSP files respectively. === Taglib Map @@ -3829,16 +3814,17 @@ elements in the Web Application Deployment descriptor. The `taglib` element is a subelement of `jsp-config` that can be used to provide information on a tag library that is used by a JSP page within the Web Application. The `taglib` -element has two subelements: `taglib-uri` and `taglib-location` . +element has two subelements: `taglib-uri` and `taglib-location`. A `taglib-uri` element describes a URI -identifying a tag library used in the web application. `The body of the` -`taglib-uri` `element may be either an absolute URI specification, or a -relative URI as in <>. There should be no entries in` `web.xml` `with the -same` `taglib-uri` `value.` +identifying a tag library used in the web application. The body of the +`taglib-uri` element may be either an absolute URI specification, or a +relative URI as in <>. There should be no +entries in `web.xml` with the same `taglib-uri` value. A `taglib-location` element contains a -resource location (as indicated in <>) of the Tag Library Description File for +resource location (as indicated in <>) of +the Tag Library Description File for the tag library. === JSP Property Groups @@ -3857,17 +3843,17 @@ its URL pattern. The applicability of a JSP property group is defined through one or more URL patterns. URL patterns use the same -syntax as defined in Chapter SRV.11 of the Servlet 2.5 specification, +syntax as defined in Chapter SRV.12 of the Servlet 5.0 specification, but are bound at translation time. All the properties in the group apply to the resources in the Web Application that match any of the URL patterns. There is an implicit property: that of being a JSP file. JSP Property Groups do not affect tag files. If a resource matches a URL pattern in both a -`` and a `` , the pattern that is +`` and a ``, the pattern that is most specific applies (following the same rules as in the Servlet specification). If the URL patterns are identical, the -`` takes precedence over the `` . +`` takes precedence over the ``. If at least one `` contains the most specific matching URL pattern, the resource is considered to be a JSP file, and the properties in that `` apply. In addition, if a @@ -3875,10 +3861,11 @@ resource is considered to be a JSP file, all `include-prelude` and `include-coda` properties apply from all the `` elements with matching URL patterns (see <>). +[[_JSP_Property_Groups]] ==== JSP Property Groups A `jsp-property-group` is a subelement of -`jsp-config` . The properties that can currently be described in a +`jsp-config`. The properties that can currently be described in a `jsp-property-group` include: * Indicate that a resource is a JSP file @@ -3898,6 +3885,7 @@ text. * Control handling of undeclared namespaces in a JSP page. +[[_Deactivating_EL_Evaluation]] ==== Deactivating EL Evaluation Since the syntactic pattern `${expr}` was @@ -3919,15 +3907,16 @@ format is to ignore EL expressions; this provides for backward compatibility. The default mode for JSP pages in a Web -Application delivered using a `web.xml` using the Servlet 2.4 format is +Application delivered using a `web.xml` using the Servlet 2.4 or later format is to evaluate EL expressions with the ${} syntax. Expressions using the #{} are evaluated starting with JSP 2.1. See -link:jsp-1.html#a28[See Backwards Compatibility with JSP 2.0.] +<> for more details on the evaluation of #{} expressions. The default mode can be explicitly changed by setting the value of the `el-ignored` element. The `el-ignored` element -is a subelement of `jsp-property-group` (see <>). It has no subelements. Its valid values are `true` and `false` . +is a subelement of `jsp-property-group` (see <<_JSP_Property_Groups>>) +It has no subelements. Its valid values are `true` and `false`. For example, the following `web.xml` fragment defines a group that deactivates EL evaluation for all JSP pages @@ -3948,7 +3937,7 @@ pages, and their meanings: [[_EL_Evaluation_Settings_for_JSP_Pages]] .EL Evaluation Settings for JSP Pages -[cols="30,03,40",options="header"] +[cols="30,30,40",options="header"] |=== |JSP Configuration @@ -3957,7 +3946,7 @@ pages, and their meanings: |unspecified |unspecified -|Ignored if <= 2.3 web.xml Evaluated otherwise. +|Ignored if web.xml \<= 2.3 Evaluated otherwise. |false |unspecified @@ -4003,22 +3992,24 @@ unit also affects whether the `\$` and `\#` quote sequences are enabled for template text and attribute values in a JSP page, document, or tag file. When EL evaluation is disabled, `\$` and `\#` will not be recognized as quotes, whereas when EL evaluation is enabled, `\$` and -`\#` will be recognized as quotes for `$` and `# respectively` . See +`\\#` will be recognized as quotes for `$` and `#` respectively. See <> and <> for details. +[[_Disabling_Scripting_Elements]] ==== Disabling Scripting Elements With the addition of the EL, some JSP page authors, or page authoring groups, may want to follow a methodology where scripting elements are not allowed. Previous versions of JSP enabled this through the notion of a `TagLibraryValidator` that would -verify that the elements are not present. JSP 2.0 makes this slightly +verify that the elements are not present. JSP 2.0 made this slightly easier through a JSP configuration element. The `scripting-invalid` element is a -subelement of `jsp-property-group` (see <>). It has no subelements. Its valid values are -`true` and `false` . Scripting is enabled by default. Disabling +subelement of `jsp-property-group` (see <<_JSP_Property_Groups>>). It +has no subelements. Its valid values are +`true` and `false`. Scripting is enabled by default. Disabling scripting elements can be done by setting the `scripting-invalid` element to `true` in the JSP configuration. @@ -4062,7 +4053,7 @@ the page encoding is determined as described in section 4.3.3 and appendix F.1 of the XML specification. The `page-encoding` element is a subelement -of `jsp-property-group` (see <>). It has no subelements. Its valid values are those of +of `jsp-property-group` (see <<_JSP_Property_Groups>>). It has no subelements. Its valid values are those of the `pageEncoding` page directive. It is a translation-time error to name different encodings in the `pageEncoding` attribute of the page directive of a JSP page and in a JSP configuration element matching the @@ -4072,7 +4063,7 @@ configuration element matching the document. It is legal to name the same encoding through multiple mechanisms. For example, the following `web.xml` fragment -defines a group that explicitly assigns `Shift`JIS` to all JSP pages and +defines a group that explicitly assigns `Shift_JIS` to all JSP pages and included JSP segments in the `/ja` subdirectory of the web application: @@ -4083,23 +4074,23 @@ included JSP segments in the `/ja` subdirectory of the web application: ==== Defining Implicit Includes The `include-prelude` element is an optional -subelement of `jsp-property-group` . It has no subelements. Its value is +subelement of `jsp-property-group`. It has no subelements. Its value is a context-relative path that must correspond to an element in the Web Application. When the element is present, the given path will be automatically included (as in an `include` directive) at the beginning -of the JSP page in the `jsp-property-group` . When there are more than +of the JSP page in the `jsp-property-group`. When there are more than one `include-prelude` element in a group, they are to be included in the order they appear. When more than one `jsp-property-group` applies to a JSP page, the corresponding include-prelude elements will be processed in the same order as they appear in the JSP configuration section of -`web.xml` . +`web.xml`. The `include-coda` element is an optional -subelement of `jsp-property-group` . It has no subelements. Its value is +subelement of `jsp-property-group`. It has no subelements. Its value is a context-relative path that must correspond to an element in the Web Application. When the element is present, the given path will be automatically included (as in an `include` directive) at the end of the -JSP page in the `jsp-property-group` . When there are more than one +JSP page in the `jsp-property-group`. When there are more than one `include-coda` element in a group, they are to be included in the order they appear. When more than one `jsp-property-group` applies to a JSP page, the corresponding `include-coda` elements will be processed in the @@ -4116,7 +4107,7 @@ defines two groups. Together they indicate that everything in directory `/two/` have `/WEB-INF/jspf/prelude1.jspf` and `/WEB-INF/jspf/prelude2.jspf` at the beginning and `/WEB-INF/jspf/coda1.jspf` and `/WEB-INF/jspf/coda2.jspf` at the end, in -that order, while other `.jsp` files only have + +that order, while other `.jsp` files only have `/WEB-INF/jspf/prelude1.jspf` at the beginning and `/WEB-INF/jspf/coda1.jspf` at the end. @@ -4138,8 +4129,9 @@ used to denote that a group of files are JSP documents, and thus must be interpreted as XML documents. The `is-xml` element is a subelement of -`jsp-property-group` (see <>). It has no subelements. Its valid values are `true` and -`false` . When `false` , the files in the associated property group are +`jsp-property-group` (see <<_JSP_Property_Groups>>). It has no subelements. +Its valid values are `true` and +`false`. When `false`, the files in the associated property group are assumed to not be JSP documents, unless there is another property group that indicates otherwise. The files are still considered to be JSP pages due to the implicit property given by the `` @@ -4147,7 +4139,7 @@ element. For example, the following `web.xml` fragment defines two groups. The first one indicates that those files with -extension `.jspx` , which is the default extension for JSP documents, +extension `.jspx`, which is the default extension for JSP documents, are instead just plain JSP pages. The last group indicates that files with extension `.svg` are actually JSP documents (which most likely are generating SVG files). @@ -4161,6 +4153,7 @@ generating SVG files). true +[[Deferred_Syntax]] ==== Deferred Syntax (character sequence `#{`) As of JSP 2.1, the character sequence `\#{` @@ -4171,9 +4164,9 @@ where jsp-version is 2.1+). The `deferred-syntax-allowed-as-literal` element is a subelement of `jsp-property-group` (See -<>). It has no -subelements. Its valid values are `true` and `false` , and it is -disabled ( `false` ) by default. Allowing the character sequence #{ +<<_JSP_Property_Groups>>). It has no +subelements. Its valid values are `true` and `false`, and it is +disabled (`false`) by default. Allowing the character sequence #{ when used as a String literal can be done by setting the `deferred-syntax-allowed-as-literal` element to `true` in the JSP configuration. @@ -4181,7 +4174,7 @@ configuration. Page authors can override the default value through the `deferredSyntaxAllowedAsLiteral` attribute of the page directive (see <>). See also -link:jsp-1.html#a28[See Backwards Compatibility with JSP 2.0.] +<> for more information. ==== Removing whitespaces from template text @@ -4191,17 +4184,17 @@ are preserved by default (See <>). Unfortunately, this means that u often make it into the response output. For example, the following code snippet -(where `↵` represents the end-of-line character(s)) +(where `\n` represents the end-of-line character(s)) - <%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %>↵ - <%@ taglib prefix=”x” uri=”http://java.sun.com/jsp/jstl/xml” %>↵ - Hello World!↵ + <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>\n + <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>\n + Hello World!\n would generate the following output: - ↵ - ↵ - Hello World!↵ + \n + \n + Hello World!\n @@ -4209,17 +4202,18 @@ For JSP pages (standard syntax), the JSP configuration element `trim-directive-whitespaces` can be used to indicate that template text containing only whitespaces must be removed from the response output. It has no effect on JSP documents (XML -syntax).In the example above, the first `↵` represents template text -that contains only whitespaces and would therefore be removed. `↵` -HelloWorld! `↵` represents template text that does not contain only +syntax). In the example above, the first `\n` represents template text +that contains only whitespaces and would therefore be removed. `\n` +HelloWorld! `\n` represents template text that does not contain only whitespaces and would therefore be preserved as-is. - ↵ - Hello World!↵ + \n + Hello World!\n The `trim-directive-whitespaces` element is a -subelement of `jsp-property-group` (See <>). It has no subelements. Its valid values are -`true` and `false` , and it is disabled ( `false` ) by default. Enabling +subelement of `jsp-property-group` (See <<_JSP_Property_Groups>>). It has +no subelements. Its valid values are +`true` and `false`, and it is disabled (`false`) by default. Enabling the trimming of whitespaces can be done by setting the `trim-directive-whitespaces` element to `true` in the JSP configuration. @@ -4230,14 +4224,14 @@ through the `trimDirectiveWhitespaces` attribute of the page directive ==== Declaring Default Content Type The JSP configuration element -default-content-type can be used to specify the default contentType -property of a group of JSP pages defined using the jsp-property-group +`default-content-type` can be used to specify the default `contentType` +property of a group of JSP pages defined using the `jsp-property-group` element. -The valid values for the default-content-type -element are those of the contentType attribute of the page directive. It -specifies the default response contentType if the page directive does -not include a contentType attribute. +The valid values for the `default-content-type` +element are those of the `contentType` attribute of the `page` directive. It +specifies the default response `contentType` if the `page` directive does +not include a `contentType` attribute. ==== Setting Default Buffer Size @@ -4267,6 +4261,29 @@ If it is set to `true`, then an error must be raised during the translation time, when an undeclared tag is used in a JSP page. +=== Backwards Compatibility with JSP 2.0 + +As of JSP 2.1, the character sequence `#{` was reserved for EL expressions. + +When used as a tag attribute value, the `\#{expr}` syntax is evaluated by the +container only if the the jsp-version element specified in the TLD has the value +2.1 or higher. If the version specified is less than 2.1, then the `#{expr}` +syntax is simply processed as a String literal. + +When used in template text in a JSP page, the `\#{` character sequence triggers a +translation error, unless specifically allowed through a configuration setup. This +is because the `#{}` syntax is associated exclusively with deferred-evaluation in JSP +2.1 and does not make sense in the context of template text (only immediate +evaluation using the `${expr}` syntax makes sense in template text). + +In a tag file, `\#{expr}` in template text is handled according to the tag file’s +JSP version: If the tag file’s JSP version is 2.0 or less, `#{expr}` in template +text will not cause any error. If the tag file’s JSP version is equal to or greater +than 2.1, `#{expr}` in template text must cause an error, unless it has been +escaped or the tag file contains a `deferredSyntaxAllowedAsLiteral` tag directive +attribute set to `TRUE`. +See <>, and <>, +for how the JSP version of a tag file is determined. == Internationalization Issues @@ -4292,8 +4309,9 @@ character set is supported. For storage and transmission over networks, however, many other character encodings are used. The Java SE platform therefore also supports character conversion to and from other character encodings. Any Java runtime must support the Unicode transformations -UTF-8, UTF-16BE, and UTF-16LE as well as the ISO-8859-1 (Latin-1) -character encoding, but most implementations support many more. +UTF-8, UTF-16BE, and UTF-16LE as well as the ISO-8859-1 (Latin-1) and +US-ASCII character encodings, but most implementations support many more. + In JSP pages and in JSP configuration elements, character encodings are named using the names defined in the IANA charset registry: @@ -4306,7 +4324,7 @@ The page character encoding is the character encoding in which the JSP page or tag file itself is encoded. The character encoding is determined for each file separately, even if one file includes another using the include directive -(<>). A detailed +(<>). A detailed algorithm for determining the page character encoding of a JSP page or tag file can be found in <>. @@ -4338,7 +4356,7 @@ order), or is `ISO-8859-1` if neither is specified. A BOM consists of the Unicode character code -U+FEFF at the beginning of a data stream, where it is used to define the +`U+FEFF` at the beginning of a data stream, where it is used to define the byte order and encoding form of unmarked plaintext files. The exact byte representation of the BOM @@ -4432,7 +4450,7 @@ of JSP pages using the jsp-property-group element. See The initial response content type is set to the `TYPE` value of the `contentType` attribute of the page directive. If the page doesn’t provide this attribute, the initial content type is -“ `text/html` ” for JSP pages in standard syntax and “ `text/xml` ” for +“`text/html`” for JSP pages in standard syntax and “`text/xml`” for JSP documents in XML syntax. The initial response character encoding is @@ -4451,14 +4469,14 @@ specified for the requested page is used; the encodings of files included via the include directive are not taken into consideration. If there’s no such specification, no initial response character encoding is passed to `ServletResponse.setContentType()` - the `ServletResponse` -object’s default, `ISO-8859-1` , is used. +object’s default, `ISO-8859-1`, is used. After the initial response character encoding has been set, the JSP page’s content can dynamically modify it by calling the `ServletResponse` object’s `setCharacterEncoding` and `setLocale` methods directly or indirectly. A number of JSTL internationalization and formatting actions call -`ServletResponse.setLocale()` , which may affect the response character +`ServletResponse.setLocale()`, which may affect the response character encoding. See the Servlet and JSTL specifications for more information. Note that the response character encoding can @@ -4487,7 +4505,7 @@ character encoding used for externalizing the XML view of a JSP page or tag file. The XML view character encoding is always -`UTF-8` . +`UTF-8`. === Delivering Localized Content @@ -4508,18 +4526,19 @@ Combinations of these approaches also make sense. == Standard Actions This chapter describes the standard -actions of Jakarta Server Pages 2.2 (JSP 2.2). Standard actions are +actions of Jakarta Server Pages 3.0 (JSP 3.0). Standard actions are represented using XML elements with a prefix of `jsp` (though that prefix can be redefined in the XML syntax). A translation error will result if the JSP prefix is used for an element that is not a standard action. +[[jsp:useBean]] === A `jsp:useBean` action associates an instance of a Java programming language object defined within a given scope and available with a given `id` with a newly declared scripting -variable of the same `id` . +variable of the same `id`. When a `` action is used in an scriptless page, or in an scriptless context (as in the body of an @@ -4528,7 +4547,7 @@ instead an EL variable is created. The `jsp:useBean` action is quite flexible; its exact semantics depends on the attributes given. The basic semantic -tries to find an existing object using `id` and `scope` . If the object +tries to find an existing object using `id` and `scope`. If the object is not found it will attempt to create the object using the other attributes. @@ -4538,7 +4557,7 @@ or in a servlet. This can be done by using the `type` attribute and not providing `class` or `beanName` attributes. At least one of `type` and `class` must be -present, and it is not valid to provide both `class` and `beanName` . If +present, and it is not valid to provide both `class` and `beanName`. If `type` and `class` are present, `class` must be assignable to `type` (in the Java platform sense). For it not to be assignable is a translation-time error. @@ -4546,16 +4565,16 @@ translation-time error. The attribute `beanName` specifies the name of a Bean, as specified in the JavaBeans specification. It is used as an argument to the `instantiate` method in the `java.beans.Beans` class. -It must be of the form `a.b.c` , which may be either a class, or the +It must be of the form `a.b.c`, which may be either a class, or the name of a resource of the form `a/b/c.ser` that will be resolved in the -current `ClassLoader` . If this is not true, a request-time exception, +current `ClassLoader`. If this is not true, a request-time exception, as indicated in the semantics of the `instantiate` method will be raised. The value of this attribute can be a request-time attribute expression. _The id Attribute_ -The `id=”name”` attribute/value tuple in a +The `id="name"` attribute/value tuple in a `jsp:useBean` action has special meaning to a JSP container, at page translation time and at client request processing time. In particular: @@ -4572,14 +4591,14 @@ in various contexts through the `pagecontext` object described later in this specification. The `name` is also used to expose a variable -( `name` ) in the page’s scripting language environment. The scope of +(`name`) in the page’s scripting language environment. The scope of the scripting language variable is dependent upon the scoping rules and capabilities of the scripting language used in the page. Note that this implies the `name` value syntax must comply with the variable naming syntax rules of the scripting language used in the page. <> provides details for the case where the language attribute -is `java` . +is `java`. An example of the scope rules just mentioned is shown next: @@ -4587,7 +4606,7 @@ is shown next: .... <% { // introduce a new block %> ... - + <% /* @@ -4612,12 +4631,12 @@ is shown next: _The scope Attribute_ The -`scope=”page|request|session|application”` attribute/value tuple is -associated with, and modifies the behavior of the `id` attribute +`scope="page|request|session|application"` attribute/value tuple is +associated with, and modifies the behavior of, the `id` attribute described above (it has both translation time and client request processing time semantics). In particular it describes the namespace, the implicit lifecycle of the object reference associated with the -`name` , and the APIs used to access this association. For all scopes, +`name`, and the APIs used to access this association. For all scopes, it is illegal to change the instance object so associated, such that its new runtime type is a subset of the type(s) of the object previously so associated. See <> for @@ -4629,7 +4648,7 @@ The actions performed in a `jsp:useBean` action are: . An attempt to locate an object based on the -attribute values `id` `and` `scope` . For application and session scope, +attribute values `id` `and` `scope`. For application and session scope, the inspection is done synchronized per scope namespace to avoid non-deterministic behavior. . A scripting language variable of the @@ -4642,14 +4661,14 @@ constructor). If the `class` attribute is used for a Java type that cannot be instantiated as a JavaBean, the container may consider the page invalid, and is recommended to (but not required to) produce a fatal translation error at translation time, or a -`java.lang.InstantiationException` `` at request time. Similarly, if +`java.lang.InstantiationException` at request time. Similarly, if either `type` or `class` specify a type that can not be found, the container may consider the page invalid, and is recommended to (but not required to) produce a fatal translation error at translation time, or a `java.lang.ClassNotFoundException` at request time. . If the object is found, the variable’s value is initialized with a reference to the located object, cast to the -specified `type` . If the cast fails, a `java.lang.ClassCastException` +specified `type`. If the cast fails, a `java.lang.ClassCastException` shall occur. This completes the processing of this `jsp:useBean` action. . If the `jsp:useBean` action had a non-empty body it is ignored. This completes the processing of this `jsp:useBean` @@ -4659,14 +4678,14 @@ scope and neither class nor beanName are given, a `java.lang.InstantiationException` shall occur. This completes the processing of this `jsp:useBean` action. . If the object is not found in the specified -`scope` , and the `class` specified names a non-abstract class that +`scope`, and the `class` specified names a non-abstract class that defines a public no-args constructor, then the class is instantiated. The new object reference is associated with the scripting variable and with the specified name in the specified scope using the appropriate -scope dependent association mechanism (see `PageContext` ). After this, +scope dependent association mechanism (see `PageContext`). After this, step 8 is performed. + If the object is not found, and the `class` -is either abstract, an `interface` , or no public no-args constructor is +is either abstract, an `interface`, or no public no-args constructor is defined therein, then a `java.lang.InstantiationException` shall occur. This completes the processing of this `jsp:useBean` action. . If the object is not found in the specified @@ -4675,7 +4694,7 @@ This completes the processing of this `jsp:useBean` action. object and the `beanName` as arguments. If the method succeeds, the new object reference is associated the with the scripting variable and with the specified name in the specified scope using the appropriate scope -dependent association mechanism (see `PageContext` ). After this, step 8 +dependent association mechanism (see `PageContext`). After this, step 8 is performed. . If the `jsp:useBean` action has a non-empty body, the body is processed. The variable is initialized and available @@ -4695,22 +4714,22 @@ In the following example, a Bean with name actions on this element, either because it was already created and found, or because it is newly created. - + In the next example, the `timeout` property is set to 33 if the Bean was instantiated. - + - + + + + + ` In the final example, the object should have been present in the session. If so, it is given the local name `wombat` -with `WombatType` . A `ClassCastException` `` may be raised if the +with `WombatType`. A `ClassCastException` may be raised if the object is of the wrong class, and an `InstantiationException` may be raised if the object is not defined. - ` + _Syntax_ @@ -4719,12 +4738,12 @@ action has no body, it is of the form: - typeSpec ::= class=”className” - | class=”className” type=”typeName” - | type=”typeName” class=”className” - | beanName=”beanName” type=”typeName” - | type=”typeName” beanName=”beanName” - | type=”typeName” + typeSpec ::= class="className" + | class="className" type="typeName" + | type="typeName" class="className" + | beanName="beanName" type="typeName" + | type="typeName" beanName="beanName" + | type="typeName" If the action has a body, it is of the form: @@ -4755,10 +4774,10 @@ variable-naming conventions. |`scope` |The scope within which the reference is -available. The default value is `page` . See the description of the +available. The default value is `page`. See the description of the `scope` attribute defined earlier herein. A translation error must occur -if scope is not one of “ `page` ”, “ `request` ”, “ `session` ” or “ -`application` ”. +if scope is not one of “`page`”, “`request`”, “`session`” or +“`application`”. |`class` |The fully qualified name of the class that @@ -4791,6 +4810,7 @@ value of the `class` attribute. |=== +[[jsp:setProperty]] === The `jsp:setProperty` action sets the values @@ -4808,7 +4828,7 @@ property type has a `PropertyEditor` class. Properties in a Bean can be set from one or more parameters in the request object, from a `String` constant, or from a computed request-time expression. Simple and indexed properties can be -set using `jsp:setProperty` . +set using `jsp:setProperty`. When assigning from a parameter in the request object, the conversions described in @@ -4816,13 +4836,15 @@ request object, the conversions described in applied, using the target property to determine the target type. When assigning from a value given as a String -constant, the conversions described in <> are applied, using the target property +constant, the conversions described in <> +are applied, using the target property to determine the target type. When assigning from a value given as a request-time attribute, no type conversions are applied if a scripting -expression is used, as indicated in <>. If an EL expression is -used, the type conversions described in Section 1.16 “Type Conversion” +expression is used, as indicated in +<>. If an EL expression is +used, the type conversions described in Section 1.23 “Type Conversion” of the EL specification document are performed. When assigning values to indexed properties @@ -4837,14 +4859,14 @@ _Examples_ The following two actions set a value from the request parameter values. - - + + The following two elements set a property from a value - - ” /> + + _Syntax_ @@ -4852,9 +4874,9 @@ _Syntax_ .... prop_expr ::= property="*" - | property=”propertyName” - | property=”propertyName” param="parameterName" - | property=”propertyName” value=”propertyValue” + | property="propertyName" + | property="propertyName" param="parameterName" + | property="propertyName" value="propertyValue" propertyValue ::= string .... @@ -4881,11 +4903,11 @@ the `` action in the same file. |`property` |The name of the property whose value will be -set. `I` `f` `propertyName` `is set to` `*` `then the tag will iterate -over the current` `ServletRequest` `parameters, matching paramet` er +set. If `propertyName` is set to `*` then the tag will iterate +over the current `ServletRequest` parameters, matching parameter names and value type(s) to property names and setter method type(s), setting each matched property to the value of the matching parameter. If -a parameter has a value of `""` , the corresponding property is not +a parameter has a value of `""`, the corresponding property is not modified. |`param` @@ -4895,7 +4917,7 @@ comes from a web form. + If `param` is omitted, the request parameter name is assumed to be the same as the bean property name. + If the `param` is not set in the Request -object, or if it has the value of `““` , the `jsp:setProperty` action +object, or if it has the value of `""`, the `jsp:setProperty` action has no effect (a noop). + An action may not have both `param` and `value` attributes. @@ -4912,7 +4934,7 @@ An action may not have both `param` and === The `` action places -the value of a bean instance property, converted to a `String` , into +the value of a bean instance property, converted to a `String`, into the implicit `out` object, from which the value can be displayed as output. The bean instance must be defined as indicated in the `name` attribute before this point in the page (usually via a `jsp:useBean` @@ -4939,9 +4961,9 @@ error, since the page implementation is in violation of the specification. NOTE: A consequence of the previous paragraph is that objects that are stored -in, say, the session by a front component are not automatically visible to jsp:set- -Property and jsp:getProperty actions in that page unless a jsp:useBean action, or -some other action, makes them visible. +in, say, the session by a front component are not automatically visible to +jsp:setProperty and jsp:getProperty actions in that page unless a +jsp:useBean action, or some other action, makes them visible. If the JSP processor can ascertain that there is an alternate way guaranteed to access the same object, it can use @@ -4952,11 +4974,11 @@ the scripting variable. The truth is always the value held by the _Examples_ - + _Syntax_ - + The attributes are: @@ -4973,15 +4995,15 @@ the property is obtained. |Names the property to get. |=== - +[[jsp:include]] === -A `` action provides for +A `` action provides for the inclusion of static and dynamic resources in the same context as the -current page. See <> for a summary of include facilities. +current page. See <> for a summary of include facilities. -Inclusion is into the current value of `out` -. The resource is specified using a `relativeURLspec` that is +Inclusion is into the current value of `out`. The resource is specified +using a `relativeURLspec` that is interpreted in the context of the web application (i.e. it is mapped). The `page` attribute of both the @@ -4992,7 +5014,7 @@ examples of combinations of this. An included page cannot change the response status code or set headers. This precludes invoking methods like -`setCookie` . Attempts to invoke these methods will be ignored. The +`setCookie`. Attempts to invoke these methods will be ignored. The constraint is equivalent to the one imposed on the `include` method of the `RequestDispatcher` class. @@ -5007,45 +5029,45 @@ The `flush` attribute controls flushing. If true, then, if the page output is buffered and the flush attribute is given a true value, then the buffer is flushed prior to the inclusion, otherwise the buffer is not flushed. The default value for the flush -attribute is `false` . +attribute is `false`. _Examples_ - + The above example is a simple inclusion of an object. The path is interpreted in the context of the Web Application. It is likely a static object, but it could be mapped into, for instance, -a servlet via `web.xml` . +a servlet via `web.xml`. For an example of a more complex set of inclusions, consider the following four situations built using four JSP -files: `A.jsp` , `C.jsp` , `dir/B.jsp` and `dir/C.jsp` : +files: `A.jsp`, `C.jsp`, `dir/B.jsp` and `dir/C.jsp` : -* `A.jsp` says `<%@ include file=”dir/B.jsp”%>` and `dir/B.jsp` -says `<%@ include file=”C.jsp”%>`. In this case the relative +* `A.jsp` says `<%@ include file="dir/B.jsp"%>` and `dir/B.jsp` +says `<%@ include file="C.jsp"%>`. In this case the relative specification `C.jsp` resolves to `dir/C.jsp`. -* `A.jsp` says `` and `dir/B.jsp` says ``. +* `A.jsp` says `` and `dir/B.jsp` says ``. In this case the relative specification `C.jsp` resolves to `dir/C.jsp`. -* `A.jsp` says `` and `dir/B.jsp` says `<%@ include file=”C.jsp” %>`. +* `A.jsp` says `` and `dir/B.jsp` says `<%@ include file="C.jsp" %>`. In this case the relative specification `C.jsp` resolves to `dir/C.jsp`. -* `A.jsp` says `<%@ include -file=”dir/B.jsp”%>` and `dir/B.jsp` says ``. +* `A.jsp` says `<%@ include +file="dir/B.jsp"%>` and `dir/B.jsp` says ``. In this case the relative specification `C.jsp` resolves to `C.jsp`. _Syntax_ - + and - + { }* @@ -5069,13 +5091,14 @@ must evaluate to a String that is a relative URL specification). | `flush` |Optional boolean attribute. If the value is -`true` , the buffer is flushed now. The default value is `false` . +`true`, the buffer is flushed now. The default value is `false`. |=== +[[jsp:forward]] === -A `` action +A `` action allows the runtime dispatch of the current request to a static resource, a JSP page or a servlet in the same context as the current page. A `jsp:forward` effectively terminates the execution of the @@ -5098,15 +5121,15 @@ was flushed, an attempt to forward the request will result in an If the page output was unbuffered and anything has been written to it, an attempt to forward the request will -result in an `IllegalStateException` . +result in an `IllegalStateException`. _Examples_ The following action might be used to forward to a static page based on some dynamic condition. - <% String whereTo = “/templates/”+someValue; %> - ’ /> + <% String whereTo = "/templates/"+someValue; %> + _Syntax_ @@ -5114,7 +5137,7 @@ _Syntax_ and - + { }* @@ -5135,14 +5158,15 @@ Accepts a request-time attribute value (which must evaluate to a String that is a relative URL specification). |=== +[[jsp:param]] === The `jsp:param` element is used to provide -key/value information. This element is used in the `jsp:include` , -`jsp:forward` , and `jsp:params` elements. A translation error shall +key/value information. This element is used in the `jsp:include`, +`jsp:forward`, and `jsp:params` elements. A translation error shall occur if the element is used elsewhere. -When doing `jsp:include` or `jsp:forward` , +When doing `jsp:include` or `jsp:forward`, the included page or forwarded page will see the original request object, with the original parameters augmented with the new parameters, in the order of appearance, with new values taking precedence over @@ -5150,12 +5174,12 @@ existing values when applicable. The scope of the new parameters is the `jsp:include` or `jsp:forward` call; i.e. in the case of an `jsp:include` the new parameters (and values) will not apply after the include. This is the same behavior as in the `ServletRequest` `include` -and `forward` methods (see Section 8.1.1 in the Servlet 2.4 +and `forward` methods (see Section 9.1.1 in the Servlet 5.0 specification). For example, if the request has a parameter `A=foo` and a parameter `A=bar` is specified for forward, the forwarded -request shall have `A=bar,foo` . Note that the new `param` has +request shall have `A=bar,foo`. Note that the new `param` has precedence. The parameter names and values specified @@ -5171,14 +5195,14 @@ _Syntax_ This action has two mandatory attributes: -`name` and `value` . `name` indicates the name of the parameter, and -`value` , which may be a request-time expression, indicates its value. +`name` and `value`. `name` indicates the name of the parameter, and +`value`, which may be a request-time expression, indicates its value. -[[_jsp:plugin]] +[[jsp:plugin]] === The plugin action enables a JSP page author to generate HTML that contains the appropriate client browser dependent -constructs ( `OBJECT` or `EMBED` ) that will result in the download of +constructs (`OBJECT` or `EMBED`) that will result in the download of the Java Plugin software (if required) and subsequent execution of the Applet or JavaBeans component specified therein. @@ -5198,7 +5222,7 @@ content to be used by the client browser if the plugin cannot be started browser or due to some other problem). If the plugin can start but the Applet or JavaBeans component cannot be found or started, a plugin specific message will be presented to the user, most likely a popup -window reporting a `ClassNotFoundException` . +window reporting a `ClassNotFoundException`. The actual plugin code need not be bundled with the JSP container and a reference to Sun’s plugin location can be @@ -5207,11 +5231,11 @@ for the benefit of their customers. _Examples_ - + + name="molecule" + value="molecules/benzene.mol"/>

unable to start plugin

@@ -5231,14 +5255,14 @@ _Syntax_ { jreversion="jreversion" } { name="componentName" } { vspace="vspace" } - { title=”title” } + { title="title" } { width="width" } { nspluginurl="url" } { iepluginurl="url" } - { mayscript=’true|false’ } > + { mayscript='true|false' } > { - { }+ + { }+ } { arbitrary_text } @@ -5311,7 +5335,7 @@ The `jsp:params` action is part of the context shall result in a translation-time error. The semantics and syntax of `jsp:params` are -described in <<_jsp:plugin>>. +described in <>. === @@ -5321,9 +5345,9 @@ The `jsp:fallback` action is part of the context shall result in a translation-time error. The semantics and syntax of `jsp:fallback` -are described in <<_jsp:plugin>>. +are described in <>. -[[_jsp:attribute]] +[[jsp:attribute]] === The `` standard action has two @@ -5344,17 +5368,17 @@ specified, as follows: * A translation error must occur if `` is used to define the value of an attribute of -`` . +``. * If the enclosing action is `` , the value of the name attribute and the body of the action will be used as attribute name/value pairs in the dynamically constructed -element. See <<_jsp:element>> for more -details on `` . Note that in this context, the attribute +element. See <> for more +details on ``. Note that in this context, the attribute does not apply to the `` action itself, but rather to the output of the element. That is, `` cannot be used to specify the `name` attribute of the `` action. * For custom action attributes of type -`jakarta.servlet.jsp.tagext.JspFragment` , the container must create a +`jakarta.servlet.jsp.tagext.JspFragment`, the container must create a `JspFragment` out of the body of the `` action and pass it to the tag handler. This applies for both Classic Tag Handlers and Simple Tag Handlers. A translation error must result if the body of the @@ -5364,14 +5388,14 @@ attributes (<>), and the name of the attribute is for the tag, then the container will evaluate the body of `` and assign the computed value to the attribute using the dynamic attribute machinery. Since the type of the attribute is -unknown and the body of `` evaluates to a `String` , the -container must pass in an instance of `String` . +unknown and the body of `` evaluates to a `String`, the +container must pass in an instance of `String`. * For standard or custom action attributes that accept a request-time expression value, the Container must evaluate the body of the `` action and use the result of this evaluation as the value of the attribute. The body of the attribute action can be any JSP content in this case. If the type of the attribute -is not `String` , the standard type conversion rules are applied, as per +is not `String`, the standard type conversion rules are applied, as per <>. * For standard or custom action attributes that do not accept a request-time expression value, the Container must @@ -5380,9 +5404,9 @@ attribute. A translation error must result if the body of the `` action contains anything but template text. If the body of the `` action -is empty, it is the equivalent of specifying `“”` as the value of the +is empty, it is the equivalent of specifying `""` as the value of the attribute. Note that after being trimmed, non-empty bodies can result in -a value of `““` as well. +a value of `""` as well. The `` action accepts a `name` attribute, a `trim` attribute, and a omit attribute. The `name` @@ -5406,22 +5430,22 @@ example assumes the name attribute is declared with type `java.lang.String` in the TLD. - + Inline definition. The following is an example of using the -`` standard action within `` , to define +`` standard action within ``, to define which attributes are to be output with that element: - - Susan + + Susan This would produce the following output: - + See <> for the formal syntax definition of the `` standard action. @@ -5435,24 +5459,24 @@ _Attributes for the `` standard action_ |`name` |(required) If not being used with -`` , then if the action does not accept dynamic attributes, +``, then if the action does not accept dynamic attributes, the name must match the name of an attribute for the action being invoked, as declared in the Tag Library Descriptor for a custom action, or as specified for a standard action, or a translation error will -result. Except for when used with `` , a translation error +result. Except for when used with ``, a translation error will result if both an XML element attribute and a `` element are used to specify the value for the same attribute. + The value of name can be a QName. If so, a translation error must occur if the prefix does not match that of the action it applies to, unless the action supports dynamic attributes, or unless the action is ``. + -When used with `` , this +When used with ``, this attribute specifies the name of the attribute to be included in the generated element. |`trim` |(optional) Valid values are `true` and -`false` . If `true` , the whitespace, including spaces, carriage +`false`. If `true`, the whitespace, including spaces, carriage returns, line feeds, and tabs, that appears at the beginning and at the end of the body of the `` action will be ignored by the JSP compiler. If `false` the whitespace is not ignored. Defaults to @@ -5460,13 +5484,13 @@ JSP compiler. If `false` the whitespace is not ignored. Defaults to |`omit` |(optional) Valid values are `true` and -`false` . If `true` , and when used with , the attribute in +`false`. If `true`, and when used with , the attribute in the element being ouput is omitted. Ignored when used with a standard or -custom action. Defaults to `false` . +custom action. Defaults to `false`. |=== -[[_jsp:body]] +[[jsp:body]] === Normally, the body of a standard or custom @@ -5483,11 +5507,10 @@ of the tag having an empty body. It is also legal to use the `` standard action to supply bodies to standard actions, for any standard -action that accepts a body (except for `` , `` -, `` , `` , and `` ). +action that accepts a body (except for ``, ``, +``, `` and ``). -The body standard action accepts no -attributes. +The body standard action accepts no attributes. === @@ -5495,9 +5518,9 @@ The `` standard action can only be used in tag files (see <>), and must result in a translation error if used in a JSP. It takes the name of an attribute that is a fragment, and invokes the fragment, -sending the output of the result to the `JspWriter` , or to a scoped +sending the output of the result to the `JspWriter`, or to a scoped attribute that can be examined and manipulated. If the fragment -identified by the given name is `null` , `` will behave as +identified by the given name is `null`, `` will behave as though a fragment was passed in that produces no output. ==== Basic Usage @@ -5506,10 +5529,10 @@ The most basic usage of this standard action will invoke a fragment with the given name with no parameters. The fragment will be invoked using the `JspFragment.invoke` method, passing in null for the `Writer` parameter so that the results will be sent to -the `JspWriter` of the `JspContext` associated with the `JspFragment` . +the `JspWriter` of the `JspContext` associated with the `JspFragment`. The following is an example of such a basic fragment invocation: - + ==== Storing Fragment Output @@ -5518,20 +5541,20 @@ and send the results to a scoped attribute for further examination and manipulation. This can be accomplished by specifying the `var` or `varReader` attribute in the action. In this usage, the fragment is invoked using the `JspFragment.invoke` method, but a custom -`java.io.Writer` is passed in instead of `null` . +`java.io.Writer` is passed in instead of `null`. If `var` is specified, the container must ensure that a `java.lang.String` object is made available in a scoped -attribute with the name specified by `var` . The `String` must contain +attribute with the name specified by `var`. The `String` must contain the content sent by the fragment to the `Writer` provided in the `JspFragment.invoke` call. If `varReader` is specified, the container must ensure that a `java.io.Reader` object is constructed and is made -available in a scoped attribute with the name specified by `varReader` . +available in a scoped attribute with the name specified by `varReader`. The `Reader` object can then be passed to a custom action for further processing. The `Reader` object must produce the content sent by the -fragment to the provided `Writer` . The `Reader` must also be +fragment to the provided `Writer`. The `Reader` must also be resettable. That is, if its `reset` method is called, the result of the invoked fragment must be able to be read again without re-executing the fragment. @@ -5542,9 +5565,9 @@ scope of the resulting scoped variable. The following is an example of using `var` or `varReader` and the `scope` attribute: - + - + ==== Providing a Fragment Access to Variables @@ -5557,7 +5580,7 @@ appears in the calling page, the JSP container provides a way to synchronize variables between the local page scope in the tag file and the page scope of the calling page. For each variable that is to be synchronized, the tag file author must declare the variable with a scope -of either `AT_BEGIN` or `NESTED` . The container must then generate code +of either `AT_BEGIN` or `NESTED`. The container must then generate code to synchronize the page scope values for the variable in the tag file with the page scope equivalent in the calling page or tag file. The details of how variables are synchronized can be found in @@ -5566,10 +5589,10 @@ details of how variables are synchronized can be found in The following is an example of a tag file providing a fragment access to a variable: - <%@ variable name-given=”x” scope=”NESTED” %> + <%@ variable name-given="x" scope="NESTED" %> ... - - + + A translation error shall result if the `` action contains a non-empty body. @@ -5593,26 +5616,26 @@ fragment during this tag invocation. store the result of the fragment invocation in, as a `java.lang.String` object. A translation error must occur if both `var` and `varReader` are specified. If neither `var` nor `varReader` are specified, the result of -the fragment goes directly to the `JspWriter` , as described above. +the fragment goes directly to the `JspWriter`, as described above. |`varReader` |(optional) The name of a scoped attribute to store the result of the fragment invocation in, as a `java.io.Reader` object. A translation error must occur if both `var` and `varReader` are specified. If neither `var` nor `varReader` is specified, the result of -the fragment invocation goes directly to the `JspWriter` , as described +the fragment invocation goes directly to the `JspWriter`, as described above. |`scope` |(optional) The scope in which to store the resulting variable. A translation error must result if the value is not -one of `page` , `request` , `session` , or `application` . A translation +one of `page`, `request`, `session`, or `application`. A translation error will result if this attribute appears without specifying either the `var` or `varReader` attribute as well. Note that a value of `session` should be used with caution since not all calling pages may be participating in a session. A container must throw an `IllegalStateException` at runtime if `scope` is `session` and the -calling page does not participate in a session. Defaults to `page` . +calling page does not participate in a session. Defaults to `page`. |=== @@ -5621,17 +5644,17 @@ calling page does not participate in a session. Defaults to `page` . The `` standard action can only be used in tag files (see <>), and must result in a translation error if used in a JSP. It invokes the body of the tag, sending the output of the result to the -`JspWriter` , or to a scoped attribute that can be examined and +`JspWriter`, or to a scoped attribute that can be examined and manipulated. The `` standard action behaves -exactly like `` , except that it operates on the body of the +exactly like ``, except that it operates on the body of the tag instead of on a specific fragment passed as an attribute. Because it always operates on the body of the tag, there is no `name` attribute for -this standard action. The `var` , `varReader` , and `scope` attributes -are all supported with the same semantics as for `` . +this standard action. The `var`, `varReader`, and `scope` attributes +are all supported with the same semantics as for ``. Fragments are provided access to variables the same way for -`` as they are for `` . If no body was passed to +`` as they are for ``. If no body was passed to the tag, `` will behave as though a body was passed in that produces no output. @@ -5656,30 +5679,30 @@ _Attributes for the `` standard action_ store the result of the body invocation in, as a `java.lang.String` object. A translation error must occur if both `var` and `varReader` are specified. If neither `var` nor `varReader` are specified, the result of -the body goes directly to the `JspWriter` , as described above. +the body goes directly to the `JspWriter`, as described above. |`varReader` |(optional) The name of a scoped attribute to store the result of the body invocation in, as a `java.io.Reader` object. A translation error must occur if both `var` and `varReader` are specified. If neither `var` nor `varReader` is specified, the result of -the body invocation goes directly to the `JspWriter` , as described +the body invocation goes directly to the `JspWriter`, as described above. |`scope` |(optional) The scope in which to store the resulting variable. A translation error must result if the value is not -one of `page` , `request` , `session` , or `application` . A translation +one of `page`, `request`, `session`, or `application`. A translation error will result if this attribute appears without specifying either the `var` or `varReader` attribute as well. Note that a value of `session` should be used with caution since not all calling pages may be participating in a session. A container must throw an `IllegalStateException` at runtime if `scope` is `session` and the -calling page does not participate in a session. Defaults to `page` . +calling page does not participate in a session. Defaults to `page`. |=== -[[_jsp:element]] +[[jsp:element]] === The `jsp:element` action is used to @@ -5689,7 +5712,7 @@ an optional body; the body can use the `jsp:attribute and jsp:body actions.` A `jsp:element` action has one mandatory -attribute, name, of type `String` . The value of the attribute is used +attribute, name, of type `String`. The value of the attribute is used as that of the tag of the element generated. _Examples_ @@ -5701,9 +5724,9 @@ the attribute is that of the expression content.lang. The body of the element is the value of the expression content.body. - ${content.lang} + ${content.lang} ${content.body} @@ -5711,7 +5734,7 @@ The next example fragment shows that `jsp:element` needs no children. The example generates an empty element with name that of the value of the expression myName. - + _Syntax_ @@ -5724,7 +5747,7 @@ or not. In the first form, no attributes are present: In the second form, zero or more attributes -are requested, using `jsp:attribute` and `jsp:body` , as appropriate. +are requested, using `jsp:attribute` and `jsp:body`, as appropriate. jsp:attribute* @@ -5735,8 +5758,8 @@ The one valid, mandatory, attribute of `jsp:element` is its name. Unlike other standard actions, the value of the `name` attribute must be given as an XML-style attribute and cannot be specified using `` This is because `` -has a special meaning when used in the body of `` . See -<<_jsp:attribute>> for more details.. +has a special meaning when used in the body of ``. See +<> for more details.. _Attributes for the `` standard action_ @@ -5745,13 +5768,13 @@ _Attributes for the `` standard action_ |`name` |(required) The value of name is that of the -element genreated. The name can be a QName; JSP 2.0 places no +element genreated. The name can be a QName; JSP 3.0 places no constraints on this value: it is accepted as is. A request-time attribute value may be used for this attribute. |=== -[[_jsp:text]] +[[jsp:text]] === A `jsp:text` action can be used to enclose @@ -5761,7 +5784,7 @@ Its syntax is: template data -The interpretation of a `jsp:text` element is to pass its content through to the current value of `out` . +The interpretation of a `jsp:text` element is to pass its content through to the current value of `out`. This is very similar to the XSLT `xsl:text` element. _Examples_ @@ -5773,7 +5796,7 @@ could be in both a JSP page or a JSP document. This is some content -Expressions may appear within `jsp:text` , as +Expressions may appear within `jsp:text`, as in the next example, where the expression foo.content is evaluated and the result is inserted. @@ -5820,14 +5843,14 @@ the form: optional body -[[_jsp:output]] +[[jsp:output]] === The `jsp:output` action can only be used in JSP documents and in tag files in XML syntax, and a translation error must result if used in a standard syntax JSP or tag file. This action is used to modify some properties of the output of a JSP document or a tag -file. In JSP 2.0 there are four properties that can be specified, all of +file. In JSP 3.0 there are four properties that can be specified, all of which affect the output of the XML prolog. The `omit-xml-declaration` property allows @@ -5837,28 +5860,28 @@ for when the generated content is XML, the default value of this property is defined so that it is unnecessary in most cases. The `omit-xml-declaration` property is of -type `String` and the valid values are “yes”, “no”, “true” and “false”. +type `String` and the valid values are "yes", "no", "true" and "false". The name, values and semantics mimic that of the `xsl:output` element in -the XSLT specification: if a value of “yes” or “true” is given, the -container will not add an XML declaration; if a value of “no” or “false” +the XSLT specification: if a value of "yes" or "true" is given, the +container will not add an XML declaration; if a value of "no" or "false" is given, the container will add an XML declaration. The default value for a JSP document that has -a `jsp:root` element is “yes”. The default value for JSP documents -without a `jsp:root` element is “no”. +a `jsp:root` element is "yes". The default value for JSP documents +without a `jsp:root` element is "no". The default value for a tag file in XML -syntax is always “yes”. If the value is “false” or “no” the tag file +syntax is always "yes". If the value is "false" or "no" the tag file will emit an XML declaration as its first content. The generated XML declaration is of the form: - + Where `encodingValue` is the response character encoding, as determined in <>. -The `doctype-root-element` , `doctype-system` +The `doctype-root-element`, `doctype-system` and `doctype-public` properties allow the page author to specify that a DOCTYPE be automatically generated in the XML prolog of the output. Without these properties, the DOCTYPE would need to be output manually @@ -5875,7 +5898,7 @@ translation error must occur. The DOCTYPE to be automatically output, if any, is statically determined at translation time. Multiple occurrences -of the `doctype-root-element` , `doctype-system` or `doctype-public` +of the `doctype-root-element`, `doctype-system` or `doctype-public` properties will cause a translation error if the values for the properties differ from the previous occurrence. @@ -5885,12 +5908,12 @@ document. The name following + If a `doctype-public` property does not appear, then the format of the generated DOCTYPE is: - + Where `nameOfRootElement` is the value of the `doctype-root-element` property, `doctypePublic` is the value of the @@ -5902,19 +5925,19 @@ The values for `doctypePublic` and depending on the value provided by the page author. It is the responsibility of the page author to provide a syntactically-valid URI as per the XML specification (see -`http://www.w3.org/TR/REC-xml#dt-sysid` ). +`http://www.w3.org/TR/REC-xml#dt-sysid`). _Examples_ The following JSP document (with an extension of `.jspx` or with `` set to `true` in the JSP configuration): - + generates an XML document as follows: - + The following JSP document is like the @@ -5922,29 +5945,29 @@ previous one, except that the XML declaration is omited. A typical use would be where the XML fragment is to be included within another document. - + + xmlns:jsp="http://java.sun.com/JSP/Page" + omit-xml-declaration="true"/> The following JSP document is equivalent but -uses `jsp:root` instead of `jsp:output` . +uses `jsp:root` instead of `jsp:output`. - - + + The following JSP document specifies both a `doctype-public` and a `doctype-system` : - - - + + +

Example XHTML Document

@@ -5952,25 +5975,25 @@ The following JSP document specifies both a and generates and XML document as follows: - - + +

Example XHTML Document

The following JSP document omits the `doctype-public` and explicitly omits the XML declaration: - + - + Element body goes here. and generates an XML document as follows: - + Element body goes here. _Syntax_ @@ -5979,13 +6002,13 @@ The `jsp:output` action cannot have a body. The action has the following syntax: .... -` +` -doctypeDecl ::= ( doctype-root-element=”rootElement” - doctype-public=”PubidLiteral” - doctype-system=”SystemLiteral” ) - | ( doctype-root-element=”rootElement” - doctype-system=”SystemLiteral” ) +doctypeDecl ::= ( doctype-root-element="rootElement" + doctype-public="PubidLiteral" + doctype-system="SystemLiteral" ) + | ( doctype-root-element="rootElement" + doctype-system="SystemLiteral" ) .... The following are the valid attributes of @@ -5998,8 +6021,8 @@ _Attribute for the `` standard action_ |`omit-xml-declaration` |(optional) Indicates whether to omit the -generation of an XML declaration. Acceptable values are “true”, “yes”, -“false” and “no”. +generation of an XML declaration. Acceptable values are "true", "yes", +"false" and "no". |`doctype-root-element` |(optional) Must be specified if and only if @@ -6021,17 +6044,17 @@ generated DOCTYPE. === Other Standard Actions -<> defines several other standard actions that are either +<> defines several other standard actions that are either convenient or needed to describe JSP pages with an XML document, some of which are available in all JSP pages. They are: -* `` , defined in <>. -* `` , defined in <>. -* `` , defined in <>. -* `` , defined in <>. - +* ``, defined in <>. +* ``, defined in <<_Scripting_Elements>>. +* ``, defined in <<_Scripting_Elements>>. +* ``, defined in <<_Scripting_Elements>>. +[[JSP_Documents]] == JSP Documents This chapter introduces two concepts @@ -6062,7 +6085,7 @@ Here is a simple JSP document: This well-formed, namespace-aware XML document generates, using the JSP standard tag library, an XML document that has `` as the root element. That element has 3 `` -subelements containing values `1` , `2` and `3` . See +subelements containing values `1`, `2` and `3`. See <> for more details of this and other examples. @@ -6074,7 +6097,7 @@ Some of the syntactic elements described in <> are not legal XML; this chapter describes alternative syntaxes for those elements that are aligned with the XML syntax. The alternative syntaxes -can be used in JSP documents; most of them ( `jsp:output` and `jsp:root` +can be used in JSP documents; most of them (`jsp:output` and `jsp:root` are exceptions) can also be used in JSP pages in JSP syntax. As it will be described later, the alternative syntax is also used in the XML view of JSP pages. @@ -6099,11 +6122,11 @@ Tag files can also be authored using XML syntax. The rules are very similar to that of JSP documents; see <> for more details. -The `XML view of a JSP page` is an XML +The _XML view of a JSP page_ is an XML document that is derived from the JSP page following a mapping defined later in this chapter. The XML view of a JSP page is intended to be used for validating the JSP page against some description of the set of valid -pages. Validation of the JSP page is supported in the JSP 2.2 +pages. Validation of the JSP page is supported in the JSP 3.0 specification through a `TagLibraryValidator` class associated with a tag library. The validator class acts on a PageData object that represents the XML view of the JSP page (see, for example, @@ -6117,7 +6140,7 @@ produce responses. [[_Relationship_between_JSP_Pages_and_XML_views_of_JSP_pages]] .Relationship between JSP Pages and XML views of JSP pages -image::sp-4.png[image] +image:sp-4.png[image] JSP documents are used by JSP page authors. They can be authored directly, using a text editor, through an XML @@ -6143,7 +6166,7 @@ explicitly indicates, through the `` element, whether a given file is a JSP document, then that indication overrides any other determination. Otherwise, * If this web application is using a version -2.4 web.xml, and if the extension is . `jspx` , then the file is a JSP +2.4 web.xml, and if the extension is . `jspx`, then the file is a JSP document. Otherwise, * If the file is explicitly or implicitly identified as a JSP page and the top element is a `jsp:root` element @@ -6160,12 +6183,12 @@ See <> for details on identifying tag files in XML synt A JSP document may or not have a `` as its top element; `` was mandatory in JSP 1.2, but we expect -most JSP documents in JSP 2.0 not to use it. +most JSP documents in JSP 3.0 not to use it. JSP documents identify standard actions through the use of a well-defined URI in its namespace; although in this chapter the prefix `jsp` is used for the standard actions, any prefix is -valid as long as the correct URI identifying JSP 2.0 standard actions is +valid as long as the correct URI identifying JSP 3.0 standard actions is used. Custom actions are identified using the URI that identifies their tag library; `taglib` directives are not required and cannot appear in a JSP document. @@ -6197,9 +6220,9 @@ fragments. Scriptlet expressions used to specify request-time attribute values use a slightly different syntax in JSP -documents than in non JSP documents; rather than using `<%= expr %>` , -they use `%= expr %` . The white space around `expr` is not needed, and -note the missing `<` and `>` . The `expr` , after any applicable quoting +documents than in non JSP documents; rather than using `<%= expr %>`, +they use `%= expr %`. The white space around `expr` is not needed, and +note the missing `<` and `>`. The `expr`, after any applicable quoting as in any other XML document, is an expression to be evaluated as in <>. @@ -6210,19 +6233,19 @@ quoted using `\$` in both attribute values and template text. Recall, however, that `\\` is not an escape sequence in XML attributes so whereas within an attribute in standard syntax `\\${1+1}` would result in `\2` (assuming EL is enabled) or `\${1+1}` (assuming EL is ignored), -in XML syntax `\\${1+1}` always results in `\${1+1}` . +in XML syntax `\\${1+1}` always results in `\${1+1}`. It should be noted that the equivalent JSP document form of + -`` , where ’a’ is not a custom action, is: +``, where ’a’ is not a custom action, is: url ]]> In the JSP document element `` , `"%= url %"` does not represent a request-time attribute value. +%">`, `"%= url %"` does not represent a request-time attribute value. That syntax only applies for custom action elements. This is in contrast -to `` , where " `${url}` " represents an EL +to ``, where "`${url}`" represents an EL expression in both JSP pages and JSP documents. ==== Semantic Model @@ -6266,8 +6289,8 @@ directly to the response or it is mediated through (standard or custom) actions. Following the XML specification (and the XSLT -specification), whitespace characters are `#x20` , `#x9` , `#xD` , or -`#xA` . +specification), whitespace characters are `#x20`, `#x9`, `#xD`, or +`#xA`. The container will add, in some conditions, an XML declaration to the output; the rules for this depend on the use @@ -6280,7 +6303,7 @@ must be validated by the container in the translation phase. Validation errors must be handled the same way as any other translation phase errors, as described in <>. -JSP 2.0 requires only DTD validation for JSP +JSP 3.0 requires only DTD validation for JSP Documents; containers should not perform validation based on other types of schemas, such as XML schema. @@ -6318,23 +6341,23 @@ XML namespaces to identify the standard actions, the directives, and the custom actions. JSP pages and tags in the JSP syntax cannot use XML namespaces and instead must use the taglib directive. -Though the prefix " `jsp` " is used +Though the prefix "`jsp`" is used throughout this specification, it is the namespace -`http://java.sun.com/JSP/Page` and not the prefix " `jsp` " that +`http://java.sun.com/JSP/Page` and not the prefix "`jsp`" that identifies the JSP standard actions. An `xmlns` attribute for a custom tag library -of the form `xml:prefix=’uri’` identifies the tag library through the +of the form _xml:prefix='uri'_ identifies the tag library through the `uri` value. The `uri` value may be of one of three forms, either a URN -of the form urn:jsptagdir:tagdir, a URN of the form `urn:jsptld:` `path` -, or a plain URI. +of the form `urn:jsptagdir:tagdir`, a URN of the form `urn:jsptld:path`, +or a plain URI. If the `uri` value is a URN of the form -`urn:jsptld:` `path` , then the TLD is determined following the +`urn:jsptld:path`, then the TLD is determined following the mechanism described in <>. If the `uri` value is a URN of the form -`urn:jsptagdir:` `tagdir` , then the TLD is determined following the +`urn:jsptagdir:tagdir`, then the TLD is determined following the mechanism described in <>. If the `uri` value is a plain URI, then a @@ -6380,17 +6403,17 @@ _Examples_ The following example generates a sequence of two XML documents. No XML declaration is generated. - +
foo
bar
The following example generates one XML document. An XML declaration is generated because of the use of -`jsp:output` . The example is mostly instructional, as the same content +`jsp:output`. The example is mostly instructional, as the same content could be generated dropping the `jsp:root` element. - + foo
@@ -6423,7 +6446,7 @@ specified version. The jsp:output element can be used in JSP documents and in tag files in XML syntax. The jsp:output element is -described in detail in <<_jsp:output>>. +described in detail in <>. ==== The jsp:directive.page Element @@ -6447,7 +6470,7 @@ The `jsp:directive.include` element is used to substitute text and/or code at JSP page translation-time. This element can appear anywhere within a JSP document. Its syntax is: - The interpretation of a `jsp:directive.include` element is as in <>. @@ -6465,13 +6488,14 @@ XML view (see <>, <>, and <> for details). +[[_Scripting_Elements]] ==== Scripting Elements The usual scripting elements: declarations, scriptlets and expressions, can be used in JSP documents, but the only valid forms for these elements in a JSP document are the XML syntaxes; -i.e. those using the elements `jsp:declaration` , `jsp:scriptlet` and -`jsp:expression` . +i.e. those using the elements `jsp:declaration`, `jsp:scriptlet` and +`jsp:expression`. The `jsp:declaration` element is used to declare scripting language constructs that are available to all other @@ -6514,7 +6538,7 @@ On the other hand, JSP documents have structure and some constraints are needed. JSP documents can generate unconstrained -content using jsp:text, as defined in <<_jsp:text>>. Jsp:text can be used to generate totally fixed content but +content using jsp:text, as defined in <>. Jsp:text can be used to generate totally fixed content but it can also be used to generate some dynamic content, as described in <> below. @@ -6523,7 +6547,7 @@ using XML fragments. A template XML element, an element that represents neither a standard action nor a custom action, can appear anywhere where a `jsp:text` may appear in a JSP document. The interpretation of such an XML element is to pass its textual representation to the current value -of `out` , after the whitespace processing described in +of `out`, after the whitespace processing described in <>. For example, if the variable i has the value @@ -6541,19 +6565,19 @@ _Example 1 - Input_ |`` |2 -|` ` +|` ` |3 -| hi you all +|`  hi you all` |4 -| ${i} +|` ${i}` |5 -| +|` ` |6 -| +|`` |=== @@ -6571,7 +6595,7 @@ _Example 1 - Output_ |` hi you all` |2 -|`` ```3` +|`3` |=== @@ -6584,15 +6608,15 @@ generated content (see <>) but the current spec support for any such constraints. The most flexible standard mechanism for -dynamic content is `jsp:element` . `jsp:element` , together with +dynamic content is `jsp:element`. `jsp:element`, together with `jsp:attribute` and `jsp:body` can be used to generate any element. Further details of jsp:element, jsp:attribute and jsp:body are given in -<<_jsp:element>>, in <<_jsp:attribute>> and in <<_jsp:body>>. The following example is from that section +<>, in <> and in <>. The following example is from that section - ${content.lang} + name="${content.headerName}" + xmlns:jsp="http://java.sun.com/JSP/Page" > + ${content.lang} ${content.body} @@ -6773,7 +6797,7 @@ the namespaces declared on the root element as valid attributes on the element type. However, to output a DOCTYPE, the - standard action specified in JSP.5.16 could be used. + + standard action specified in <> could be used. The action could be implemented either through a custom action or through a tag. For example, as a tag @@ -6782,7 +6806,7 @@ it could be defined by the following code: .... - + @@ -6809,7 +6833,7 @@ versions of the JSP specification. ==== Generating XML Content Natively -All JSP 2.0 content is textual, even when +All JSP 3.0 content is textual, even when using JSP documents to generate XML content. This is quite acceptable, and even ideal, for some applications, but in some other applications XML documents are the main data type being manipulated. For example, the @@ -6840,7 +6864,7 @@ This chapter describes the tag library facility for introducing new actions into a JSP page. The tag library facility includes portable run-time support, a validation mechanism, and authoring tool support. Both the classic JSP 1.2 style tag extension -mechanism and the newer JSP 2.0 simple tag extension mechanism are +mechanism and the newer JSP 2.0 onwards simple tag extension mechanism are described. In <>, a mechanism for authoring tag extensions using only JSP syntax is described. This brings the power of tag extensions to page authors that may not know the @@ -6848,8 +6872,8 @@ Java programming language. This chapter also provides an overview of the tag library concept. It describes the Tag Library Descriptor, and the -`taglib` directive. A detailed description of the APIs involved follows -in link:jakarta.servlet.jsp.tagext.html#UNKNOWN[]. +`taglib` directive. A detailed description of the APIs involved may be +found in the `jakarta.servlet.jsp.tagext` Javadoc. === Introduction @@ -6947,7 +6971,7 @@ provide location information on errors. Each custom tag in the library is checked for a `TagExtraInfo` class. If one is present, its `validate` method is -invoked. The default implementation of `validate` is to call `isValid` . +invoked. The default implementation of `validate` is to call `isValid`. See the APIs for more details. _Translation_ @@ -6970,7 +6994,7 @@ invoked in them. ==== Classic Tag Handlers A classic tag handler is a Java class that -implements the `Tag` , `IterationTag` , or `BodyTag` interface, and is +implements the `Tag`, `IterationTag`, or `BodyTag` interface, and is the run-time representation of a custom action. The JSP page implementation class @@ -6980,15 +7004,15 @@ object that implements the `jakarta.servlet.jsp.tagext.Tag` interface. The handler object is responsible for the interaction between the JSP page and additional server-side objects. -There are three main interfaces: `Tag` , -`IterationTag` , and `BodyTag` . +There are three main interfaces: `Tag`, +`IterationTag`, and `BodyTag`. * The `Tag` interface defines the basic methods needed in all tag handlers. These methods include setter methods to initialize a tag handler with context data and attribute values of the action, and the `doStartTag` and `doEndTag` methods. * The `IterationTag` `interface` is an -extension to `Tag` that provides the additional method, `doAfterBody` , +extension to `Tag` that provides the additional method, `doAfterBody`, invoked for the reevaluation of the body of the tag. * The `BodyTag` interface is an extension of `IterationTag` with two new methods for when the tag handler wants to @@ -6999,13 +7023,13 @@ buffer. The use of interfaces simplifies making an existing Java object a tag handler. There are also two support classes -that can be used as base classes: `TagSupport` and `BodyTagSupport` . +that can be used as base classes: `TagSupport` and `BodyTagSupport`. JSP 1.2 introduced a new interface designed to help maintain data integrity and resource management in the presence of exceptions. The `TryCatchFinally` interface is a “mix-in” interface -that can be added to a class implementing any of `Tag` , `IterationTag` -, or `BodyTag` . +that can be added to a class implementing any of `Tag`, `IterationTag` +, or `BodyTag`. ==== Simple Examples of Classic Tag Handlers @@ -7024,7 +7048,7 @@ tag handler that implements the `Tag` interface. The tag handler needs to use only the `doStartTag` method which is invoked when the start tag is encountered. It can access the attributes of the tag and information about the state of the JSP page. The information is passed to the `Tag` -object through setter method calls, prior to the call to `doStartTag` . +object through setter method calls, prior to the call to `doStartTag`. Since simple actions with empty tag bodies are common, the Tag Library Descriptor can be used to indicate that the @@ -7066,7 +7090,7 @@ be further manipulated for whatever reason, including just discarding it, we need a way to divert the output of reevaluations. This is done through the creation of a `BodyContent` object and use of the `setBodyContent` method, which is part of the `BodyTag` interface. -`BodyTag` also provides the `doInitBody` `` method which is invoked +`BodyTag` also provides the `doInitBody` method which is invoked after `setBodyContent` and before the first body evaluation provides an opportunity to interact with the body. @@ -7098,7 +7122,7 @@ tag library author. This information is used at JSP page translation time and can be described in one of two ways: directly in -the TLD for simple cases, or through subclasses of `TagExtraInfo` . +the TLD for simple cases, or through subclasses of `TagExtraInfo`. Either mechanism will indicate the names and types of the scripting variables. @@ -7113,7 +7137,7 @@ variables. There are some sections of JSP where scripting is not allowed. For example, this is the case in a tag body -where the `body-content` is declared as ‘ `scriptless` ’, or in a page +where the `body-content` is declared as ‘`scriptless`’, or in a page where `` is true. In these sections, it is not possible to access scripting variables directly via scriptlets or expressions, and therefore the container need not synchronize them. @@ -7133,7 +7157,7 @@ JSP pages that do not need scriptlets or scriptlet expressions. This allows us to define a tag invocation protocol that is easier to use for many use cases. -In that interest, JSP 2.0 introduces a new +In that interest, JSP 2.0 introduced a new type of tag extension called a Simple Tag Extension. Simple Tag Extensions can be written in one of two ways: @@ -7143,7 +7167,7 @@ class is intended for use by advanced page authors and tag library developers who need the flexibility of the Java language in order to write their tag handlers. The `jakarta.servlet.jsp.tagext.SimpleTagSupport` class provides a default -implementation for all methods in `SimpleTag` . +implementation for all methods in `SimpleTag`. * In JSP, using tag files. This method can be used by page authors who do not know Java. It can also be used by advanced page authors or tag library developers who know Java but are @@ -7166,8 +7190,8 @@ facilitated by the `JspContext` class, which `PageContext` now extends. `JspContext` provides generic services such as storing the `JspWriter` and keeping track of scoped attributes, whereas `PageContext` has functionality specific to serving JSPs in the context of servlets. -Whereas the `Tag` interface relies on `PageContext` , `SimpleTag` only -relies on `JspContext` . +Whereas the `Tag` interface relies on `PageContext`, `SimpleTag` only +relies on `JspContext`. The body of a Simple Tag, if present, is translated into a JSP Fragment and passed to the `setJspBody` method. @@ -7188,7 +7212,7 @@ of the page are translated into implementations of the `jakarta.servlet.jsp.tagext.JspFragment` abstract class, before being passed to a tag handler. This is done automatically for any JSP code in the body of a named attribute (one that is defined by `` -) that is declared to be a fragment, or of type `JspFragment` , in the +) that is declared to be a fragment, or of type `JspFragment`, in the TLD. This is also automatically done for the body of any tag handled by a Simple Tag handler. Once passed in, the tag handler can then evaluate and re-evaluate the fragment as many times as needed, or even pass it @@ -7202,14 +7226,15 @@ A translation error must occur if a piece of JSP code that is to be translated into a JSP Fragment contains scriptlets or scriptlet expressions. -See link:jakarta.servlet.jsp.tagext.html#UNKNOWN[] +See the `jakarta.servlet.jsp.tagext` Javadoc for more details on the `JspFragment` abstract class. ==== Simple Examples of Simple Tag Handlers In this section, we revisit the prototypical uses of classic tag extensions, as was presented in -<>, and briefly describe how they are implemented using simple tag handlers. +<>, and briefly describe how they +are implemented using simple tag handlers. ===== Plain Actions @@ -7217,8 +7242,8 @@ To implement plain actions, the tag library developer creates a class that extends `SimpleTagSupport` and implements the `doTag` method. The details on accessing attributes and enforcing an empty body are the same as with classic tag handlers. By default, the -rest of the page will be evaluated after invoking `doTag` . To signal -that the page is to be skipped, `doTag` throws `SkipPageException` . +rest of the page will be evaluated after invoking `doTag`. To signal +that the page is to be skipped, `doTag` throws `SkipPageException`. ===== Actions with a Body @@ -7233,7 +7258,7 @@ variables through the `JspContext` object. All conditional logic is handled in the `doTag` method. If the body is not to be invoked, the tag library developer simply does not call `invoke` on the `JspFragment` object -passed in via `setJspBody` . +passed in via `setJspBody`. ===== Iterations @@ -7245,7 +7270,7 @@ method. The tag library developer simply calls `invoke` on the To divert the result of the body invocation, the tag library developer passes a `java.io.Writer` object to the -`invoke` method on the body `JspFragment` . Unlike the standard tag +`invoke` method on the body `JspFragment`. Unlike the standard tag handler’s `BodyContent` solution, the result of the invocation does not need to be buffered. @@ -7255,14 +7280,14 @@ Cooperating actions work the same way as with classic tag handlers. A `setParent` method is available in the `SimpleTag` interface and is called by the container before calling `doTag` if one tag invocation is nested within another. A -`findAncestorWithClass` method is available on `SimpleTagSupport` . This +`findAncestorWithClass` method is available on `SimpleTagSupport`. This should be used, instead of `TagSupport.findAncestorWithClass(),` in all -cases where the desired return value may implement `SimpleTag` . +cases where the desired return value may implement `SimpleTag`. -Note that `SimpleTag` does not extend `Tag` . +Note that `SimpleTag` does not extend `Tag`. Because of this, the `JspTag` common base is used in these new APIs -instead of `Tag` . Furthermore, because `Tag.setParent` only accepts an -object of type `Tag` , tag collaboration becomes more difficult when +instead of `Tag`. Furthermore, because `Tag.setParent` only accepts an +object of type `Tag`, tag collaboration becomes more difficult when classic tag handlers are nested inside `SimpleTag` custom actions. To make things easier, the @@ -7270,11 +7295,11 @@ To make things easier, the expose it as if it were a `Tag` instace. The original `JspTag` can be retrieved through its `getAdaptee` method. Whenever calling the `setParent` method on a classic `Tag` in a case where the outer tag does -not implement `Tag` , the JSP Container must construct a new +not implement `Tag`, the JSP Container must construct a new `TagAdapter` and call `setParent` on the classic `Tag` passing in the adapter. -See link:jakarta.servlet.jsp.tagext.html#UNKNOWN[] +See the `jakarta.servlet.jsp.tagext` Javadoc for more details on these APIs. ==== Attributes With Dynamic Names @@ -7287,22 +7312,22 @@ not known until the page author uses the tag. For example, it is time consuming and error-prone to anticipate what attributes a user may wish to pass to a tag that mimics an HTML element. -New to JSP 2.0 is the ability to declare that +Available since JSP 2.0 is the ability to declare that a tag handler accepts additional attributes with dynamic names. This is done by having the tag handler implement the `jakarta.servlet.jsp.tagext.DynamicAttributes` interface. See -link:jakarta.servlet.jsp.tagext.html#UNKNOWN[] for more details on this +the `jakarta.servlet.jsp.tagext` Javadoc for more details on this interface. ==== Event Listeners A tag library may include classes that are -event listeners (see the Servlet 2.5 specification). The listeners +event listeners (see the Servlet 5.0 specification). The listeners classes are listed in the tag library descriptor and the JSP container automatically instantiates them and registers them. A Container is required to locate all TLD files (see <> for details on how they are identified), read their `listener` elements, and treat the event -listeners as extensions of those listed in `web.xml` . +listeners as extensions of those listed in `web.xml`. The order in which the listeners are registered is undefined, but they are registered before application @@ -7324,7 +7349,7 @@ to as annotations. In Jakarta EE, annotations are used to declare dependencies on external resources and configuration data in Java code without the need to define that data in a configuration file. -Section SRV.14.5 of the Servlet Specification +Section SRV.15.5 of the Servlet Specification describes the behavior of annotations and resource injection in Jakarta EE technology compliant web containers. @@ -7345,10 +7370,10 @@ The annotations supported are: * `@PersistenceContext`, `@PersistenceContexts` * `@PersistenceUnit`, `@PersistenceUnits` * `@PostConstruct`, `@PreDestroy` -* `@Resource` , `@Resources` +* `@Resource`, `@Resources` * `@WebServiceRef`, `@WebServiceRefs` -Please see Section SRV.14.5 of the servlet +Please see Section SRV.15.5 of the servlet specification for more details on these annotations. A JSP container that is not part of a Jakarta EE @@ -7379,13 +7404,14 @@ handler classes as indicated in <> below. JSP page authoring tools and JSP containers are required to accept a tag library that is packaged as a JAR file. When deployed in a JSP container, the standard JAR conventions described -in the Servlet 2.5 specification apply, including the conventions for +in the Servlet 5.0 specification apply, including the conventions for dependencies on extensions. Packaged tag libraries must have at least one tag library descriptor file. The JSP 1.1 specification allowed only a -single TLD, in `META-INF/taglib.tld` , but as of JSP 1.2 multiple tag -libraries are allowed. See <> for how TLDs are identified. +single TLD, in `META-INF/taglib.tld`, but as of JSP 1.2 multiple tag +libraries are allowed. See <> for +how TLDs are identified. Both Classic and Simple Tag Handlers (implemented either in Java or as tag files) can be packaged together. @@ -7395,7 +7421,7 @@ Both Classic and Simple Tag Handlers A tag library contains classes for instantiation at translation time and classes for instantiation at request time. The former include classes such as `TagLibraryValidator` -and `TagExtraInfo` . The latter include tag handler and event listener +and `TagExtraInfo`. The latter include tag handler and event listener classes. The usual conventions for Java classes apply: @@ -7468,7 +7494,7 @@ extensible TLD that can be used as a true single-source document. ==== Identifying Tag Library Descriptors Tag library descriptor files have names that -use the extension `.tld` , and the extension indicates a tag library +use the extension `.tld`, and the extension indicates a tag library descriptor file. When deployed inside a JAR file, the tag library descriptor files must be in the `META-INF` directory, or a subdirectory of it. When deployed directly into a web application, the tag library @@ -7476,11 +7502,10 @@ descriptor files must always be in the `WEB-INF` directory, or some subdirectory of it. TLD files should not be placed in `/WEB-INF/classes` or `/WEB-INF/lib, and must not be placed inside /WEB-INF/tags or a subdirectory of it, unless named implicit.tld and intended to configure -an implicit tag library with its JSP version and tlib-version` . +an implicit tag library with its JSP version and tlib-version`. The XML Schema for a TLD document is -`http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary`2`1.xsd` . See -link:jsp.html#a3944[See XML Schema for TLD, JSP 2.1.]. +`http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_1.xsd`. Note that tag files, which collectively form tag libraries, may or may not have an explicitly defined TLD. In the @@ -7492,12 +7517,14 @@ be found in <>. ==== TLD resource path A URI in a `taglib` directive is mapped into -a context relative path (as discussed in <>). The context relative path is a URL without a protocol and host components that starts with `/` and is called the TLD resource path. +a context relative path (as discussed in <>). The +context relative path is a URL without a protocol and host components that +starts with `/` and is called the TLD resource path. The TLD resource path is interpreted relative to the root of the web application and should resolve to a TLD file directly, or to a JAR file that has a TLD file at location -`META-INF/taglib.tld` . If the TLD resource path is not one of these two +`META-INF/taglib.tld`. If the TLD resource path is not one of these two cases, a fatal translation error will occur. The URI describing a tag library is mapped to @@ -7506,7 +7533,8 @@ that is to be used if the map does not contain the URI. The taglib map is built from an explicit taglib map in `web.xml` (described in <>) that is extended with implicit entries deduced from packaged tag libraries in -the web application (described in <>), and implicit entries known to the +the web application (described in <>), and +implicit entries known to the JSP container. The fallback interpretation is targetted to a casual use of the mechanism, as in the development cycle of the Web Application; in that case the URI is interpreted as a direct path to the TLD (see @@ -7541,7 +7569,7 @@ Application. The new entries are computed as follows: * The container searches for all files with a `.tld` extension under `/WEB-INF` or a subdirectory, and inside JAR -files that are in `/WEB-INF/lib` . When examining a JAR file, only +files that are in `/WEB-INF/lib`. When examining a JAR file, only resources under `/META-INF` or a subdirectory are considered. The order in which these files are searched for is implementation-specific and should not be relied on by web applications. @@ -7556,7 +7584,7 @@ This mechanism provides an automatic URI to TLD mapping as well as supporting multiple TLDs within a packaged JAR. Note that this functionality does not require explicitly naming the location of the TLD file, which would require a mechanism like the -`jar:protocol` . +`jar:protocol`. Note also that the mechanism does not add duplicated entries. @@ -7589,52 +7617,57 @@ as long as the result is preserved. The taglib map generated in Sections <>, <> and -<> may contain one or more `` entries. Each entry is identified by a `taglib`uri` , which is the value of the `` subelement. This `taglib`uri` may be an absolute URI, or a relative URI spec starting with `/` or one not starting with `/`. Each entry also defines a `taglib`location` as follows: +<> may contain one or more +`` entries. Each entry is identified by a `taglib_uri`, +which is the value of the `` subelement. This `taglib_uri` +may be an absolute URI, or a relative URI spec starting with `/` or one +not starting with `/`. Each entry also defines a `taglib_location` as +follows: * If the `` subelement is some relative URI specification that starts with a `/` the -`taglib`location` is this URI. +`taglib_location` is this URI. * If the `` subelement is -some relative URI specification that does not start with `/` , the -`taglib`location` is the resolution of the URI relative to +some relative URI specification that does not start with `/`, the +`taglib_location` is the resolution of the URI relative to `/WEB-INF/web.xml` (the result of this resolution is a relative URI -specification that starts with `/` ). +specification that starts with `/`). ===== Computing the TLD Resource Path The following describes how to resolve a `taglib` directive to compute the TLD resource path. It is based on the -value of the `` `uri` attribute of the `taglib` directive. +value of the `uri` attribute of the `taglib` directive. -* If `uri` is `abs`uri` , an absolute URI +* If `uri` is `abs_uri`, an absolute URI Look in the taglib map for an entry whose -`taglib`uri` is `abs`uri` . If found, the corresponding -`taglib`location` is the TLD resource path. If not found, a translation +`taglib_uri` is `abs_uri`. If found, the corresponding +`taglib_location` is the TLD resource path. If not found, a translation error is raised. -* If `uri` is `root`rel`uri` , a relative URI +* If `uri` is `root_rel_uri`, a relative URI that starts with `/` Look in the taglib map for an entry whose -`taglib`uri` is `root`rel`uri` . If found, the corresponding -`taglib`location` is the TLD resource path. If no such entry is found, -`root`rel`uri` is the TLD resource path. +`taglib_uri` is `root_rel_uri`. If found, the corresponding +`taglib_location` is the TLD resource path. If no such entry is found, +`root_rel_uri` is the TLD resource path. -* If `uri` is `noroot`rel`uri` , a relative +* If `uri` is `noroot_rel_uri`, a relative URI that does not start with `/` Look in the `taglib map` for an entry whose -`taglib`uri` is `noroot`rel`uri` . If found, the corresponding -`taglib`location` is the TLD resource path. If no such entry is found, -resolve `noroot`rel`uri` relative to the current JSP page where the +`taglib_uri` is `noroot_rel_uri`. If found, the corresponding +`taglib_location` is the TLD resource path. If no such entry is found, +resolve `noroot_rel_uri` relative to the current JSP page where the directive appears; that value (by definition, this is a relative URI -specification that starts with `/` ) is the TLD resource path. For +specification that starts with `/`) is the TLD resource path. For example, if `/a/b/c.jsp` references + -`../../WEB-INF/my.tld` , then if there is no `taglib`location` that +`../../WEB-INF/my.tld`, then if there is no `taglib_location` that matches + -`../../WEB-INF/my.tld` , the TLD resource path would be -`/WEB-INF/my.tld` . +`../../WEB-INF/my.tld`, the TLD resource path would be +`/WEB-INF/my.tld`. ===== Usage Considerations @@ -7647,45 +7680,45 @@ file implementing a tag library can be dropped in and used immediatedly through its stable URIs. The use of relative URI specifications in the -taglib map enables very short names in the `taglib` `` directive. For +taglib map enables very short names in the `taglib` directive. For example, if the map is: /myPRlibrary - /WEB-INF/tlds/PRlibrary`1`4.tld + /WEB-INF/tlds/PRlibrary_1_4.tld then it can be used as: - <%@ taglib uri=”/myPRlibrary” prefix=”x” %> + <%@ taglib uri="/myPRlibrary" prefix="x" %> Finally, the fallback rule allows a `taglib` directive to refer directly to the TLD. This arrangement is very convenient for quick development at the expense of less flexibility and accountability. For example, in the case above, it enables: - <%@ taglib uri=”/WEB-INF/tlds/PRlibrary`1`4.tld” prefix=”x” %> + <%@ taglib uri="/WEB-INF/tlds/PRlibrary_1_4.tld" prefix="x" %> ==== Translation-Time Class Loader The set of classes available at translation time is the same as that available at runtime: the classes in the underlying Java platform, those in the JSP container, and those in the -class files in `WEB-INF/classes` , in the JAR files in `WEB-INF/lib` , +class files in `WEB-INF/classes`, in the JAR files in `WEB-INF/lib`, and, indirectly those indicated through the use of the `class-path` attribute in the `META-INF/MANIFEST` file of these JAR files. ==== Assembling a Web Application As part of the process of assembling a web -application, the Application Assembler will create a `WEB-INF/` `` +application, the Application Assembler will create a `WEB-INF/` directory, with appropriate `lib/` and `classes/` subdirectories, place JSP pages, servlet classes, auxiliary classes, and tag libraries in the proper places, and create a `WEB-INF/web.xml` that ties everything together. Tag libraries that have been delivered in the -standard JAR format can be dropped directly into `WEB-INF/lib` . This +standard JAR format can be dropped directly into `WEB-INF/lib`. This automatically adds all the TLDs inside the JAR, making their URIs advertised in their `` elements visible to the URI to TLD map. The assembler may create `taglib` entries in `web.xml` for each of the @@ -7723,7 +7756,7 @@ compile-time, deployment-time, or run-time. JSP containers must not alter their behavior based on the content, the presence, or the absence of a particular Tag or Tag Library Extension Element. In addition, JSP containers must consider invalid any tag library that specifies -`mustUnderstand=”true”` for any Tag or Tag Library Extension element. +`mustUnderstand="true"` for any Tag or Tag Library Extension element. Any attempt to use an invalid tag library must produce a translation error. This is to preserve application compatibility across containers. @@ -7734,10 +7767,10 @@ validated by the JSP Container. Tag Library Extension Elements provide extension information at the tag library level, and are specified by -adding a `` element as a child of `` . Tag +adding a `` element as a child of ``. Tag Extension Elements provide extension information at the tag level, and are specified by adding a `` element as a child of -`` . To use these elements, an XML namespace must first be defined +``. To use these elements, an XML namespace must first be defined and the namespace must be imported into the TLD. ===== Example @@ -7757,13 +7790,13 @@ extensions to provide helpful voice annotations that describe how to use each tag in the tag library. Relevant parts highlighted in bold: .... - Simple Math Tag Library. Contains ACME sound extensions with helpful voice annotations @@ -7785,26 +7818,26 @@ each tag in the tag library. Relevant parts highlighted in bold: y java.lang.Double - + - + 1.5 sounds/add.au - + sounds/add-x.au - + sounds/add-y.au - + - + 1.5 sounds/intro.au @@ -7816,15 +7849,15 @@ each tag in the tag library. Relevant parts highlighted in bold: The corresponding `acme.xsd` file would look something like: .... - - + + This an XML Schema for sample Acme taglib extensibility @@ -7834,35 +7867,35 @@ The corresponding `acme.xsd` file would look something like: - + - + Extension for sounds associated with a tag - + - - - + + + - - + + - + @@ -7885,7 +7918,7 @@ development group may want to constrain the way some features are used. Validation can be done either at translation-time or at request-time. In general translation-time -validation provides a better user experience, and the JSP 2.2 +validation provides a better user experience, and the JSP 3.0 specification provides a very flexible translation-time validation mechanism. @@ -8005,7 +8038,7 @@ information that is not described in the current version of the TLD with some tag library, it can do so by inserting the information in a document it controls, inserting the document in the `WEB-INF` portion of the Web Application where the Tag Library resides, and using the -standard Servlet 2.4 mechanisms to access that information. +standard Servlet 5.0 mechanisms to access that information. ==== Customizing a Tag Library @@ -8014,17 +8047,17 @@ and deployment time. For example, a tag library that provides access to databases may be customized with login and password information. There is no convenient place in `web.xml` in -the Servlet 2.4 spec for customization information A standardized +the Servlet 5.0 spec for customization information. A standardized mechanism is probably going to be part of a forthcoming JSP specification, but in the meantime the suggestion is that a tag library author place this information in a well-known location at some resource -in the `WEB-INF/` `` portion of the Web Application and access it via -the `getResource` call on the `ServletContext` . +in the `WEB-INF/` portion of the Web Application and access it via +the `getResource` call on the `ServletContext`. == Tag Files This chapter describes the details of tag -files, a JSP 2.0 facility that allows page authors to author tag +files, a JSP 2.0 onwards facility that allows page authors to author tag extensions using only JSP syntax. In the past, the ability to encapsulate presentation logic into reusable, full-featured tag libraries was only available to developers that had a reasonable amount @@ -8052,8 +8085,8 @@ The required file extension for a tag file are `.tag` or `.tagx.` As is the case with JSP files, the actual tag may be composed of a top file that includes other files that contain either a complete tag or a segment of a tag file. Just as the recommended -extension for a segment of a JSP file is `.jspf` , the recommended -extension for a segment of a tag file is `.tagf` . +extension for a segment of a JSP file is `.jspf`, the recommended +extension for a segment of a tag file is `.tagf`. === Syntax of Tag Files @@ -8062,11 +8095,13 @@ of a JSP page, with the following exceptions: * Directives - Some directives are not available or have limited availability, and some tag file specific -directives are available. See <> for a discussion on tag file directives. +directives are available. See <> for a discussion +on tag file directives. * The `` and `` standard actions can only be used in Tag Files. -The EBNF grammar in <> describes the syntax of tag files. The root production for a tag files is `JSPTagDef`. +The EBNF grammar in <> describes the syntax of tag +files. The root production for a tag files is `JSPTagDef`. See <> for details on tag files in XML syntax. @@ -8084,13 +8119,13 @@ tag handler, the following conditions must hold true for all tag handlers defined as tag files: * The tag file implementation must keep a -copy of the `JspContext` `` instance passed to it by the invoking page +copy of the `JspContext` instance passed to it by the invoking page via the `setJspContext` method. This is called the `Invoking JSP -Context` . +Context`. * The tag file implementation must create and maintain a second instance of `JspContext` called a `JSP Context -Wrapper` . If the Invoking JSP Context is an instance of `PageContext` , -the JSP Context Wrapper must also be an instance of `PageContext` . This +Wrapper`. If the Invoking JSP Context is an instance of `PageContext`, +the JSP Context Wrapper must also be an instance of `PageContext`. This wrapper must be returned when `getJspContext()` is called. * For each invocation to the tag, the JSP Context Wrapper must present a clean page scope containing no initial @@ -8112,7 +8147,7 @@ accepts dynamic attributes, then the names and values of those dynamic attributes must be exposed to the tag file as specified in <<_Details_of_tag_directive_attribute>>. + If the attribute is a deferred-value, it is directly mapped. If the -attribute is a deferred-method, it is wrapped in a `ValueExpression` , +attribute is a deferred-method, it is wrapped in a `ValueExpression`, and the resulting `ValueExpression` is mapped. + There are two implications here. They are best illustrated by examples. Suppose we have a tag file tagf.tag: @@ -8127,27 +8162,27 @@ used in test.jsp <%@ taglib prefix="my" tagdir="/WEB-INF/tags"%> -First, in `tagf.tag` , `${attr1.bar}` will cause the immediate +First, in `tagf.tag`, `${attr1.bar}` will cause the immediate evaluation of the deferred expression. Secondly, since the `VariableMapper` is used to resolve variables at EL parse time, a -deferred expression such as `#{attr1.foo}` is not dependent on `attr1` +deferred expression such as `\#{attr1.foo}` is not dependent on `attr1` anymore, so that it can be evaluated long after the end of life of the tag file's pageContext. This is very useful for Jakarta Server Faces applications. + Since the EL syntax does not allow for invokation of the method in a -`MethodExpression` , the only allowable use of `attr2` is to pass it to -another tag that has a deferred-method attribute, in the form of " -`#{attr2}` ". +`MethodExpression`, the only allowable use of `attr2` is to pass it to +another tag that has a deferred-method attribute, in the form of +"`#{attr2}`". * For all intents and purposes other than for -synchronizing the `AT_BEGIN` , `NESTED` , and `AT_END` scripting +synchronizing the `AT_BEGIN`, `NESTED`, and `AT_END` scripting variables, the effective `JspContext` for the tag file is the JSP Context Wrapper. For example, the `jspContext` scripting variable must point to the JSP Context Wrapper instead of the invoking JSP Context. * The tag handler must behave as though a tag library descriptor entry was defined for it, in accordance with the -`tag` , `attribute` , and `variable` directives that appear in the tag +`tag`, `attribute`, and `variable` directives that appear in the tag file translation unit. It is legal for a tag file to forward to a @@ -8155,8 +8190,8 @@ page via the `` standard action. Just as for JSP pages, the forward is handled through the request dispatcher. Upon return from the `RequestDispatcher.forward` method, the generated tag handler must stop processing of the tag file and throw -`jakarta.servlet.jsp.SkipPageException` . Similarly, if a tag file invokes -a Classic Tag Handler which returns `SKIP`PAGE` from the `doEndTag` +`jakarta.servlet.jsp.SkipPageException`. Similarly, if a tag file invokes +a Classic Tag Handler which returns `SKIP_PAGE` from the `doEndTag` method, or if it invokes a Simple Tag Handler which throws `SkipPageException` in the `doTag` method, the generated tag handler must terminate and `SkipPageException` must be thrown. In either of @@ -8168,19 +8203,20 @@ called. Care should be taken when invoking a classic tag handler from a tag file. In general, SimpleTag Extensions can be used in environments other than servlet environments. However, because -the `Tag` interface relies on `PageContext` , which in turn assumes a +the `Tag` interface relies on `PageContext`, which in turn assumes a servlet environment, using classic tag handlers indirectly binds the use of the tag file to servlet environments. Nonetheless, the JSP container must allow such an invocation to occur. When a tag file attempts to invoke a classic tag handler (i.e. one that implements the `Tag` interface), it must cast the `JspContext` passed to the `SimpleTag` into -a `PageContext` . In the event that the class cast fails, the invocation +a `PageContext`. In the event that the class cast fails, the invocation of the classic tag fails, and a `JspException` must be thrown. If a tag file in XML syntax contains a jsp:root element, the value of that element’s version attribute must -match the tag file’s JSP version. See <>, and <>, for how the JSP version of a tag file -is determined. +match the tag file’s JSP version. See <>, and +<>, for how the JSP version +of a tag file is determined. === Packaging Tag Files @@ -8197,15 +8233,15 @@ power and flexibility as classic tag handlers have. Tag extensions written in JSP using tag files can be placed in one of two locations. The first possibility is in the -`/META-INF/tags/` directory (or a subdirectory of `/META-INF/tags/` ) in +`/META-INF/tags/` directory (or a subdirectory of `/META-INF/tags/`) in a `JAR` file installed in the `/WEB-INF/lib/` directory of the web application. Tags placed here are typically part of a reusable library of tags that can be easily dropped into any web application. The second possibility is in the -`/WEB-INF/tags/` directory (or a subdirectory of `/WEB-INF/tags/` ) of +`/WEB-INF/tags/` directory (or a subdirectory of `/WEB-INF/tags/`) of the web application. Tags placed here are within easy reach and require -little packaging. Only files with a `.tag` or . `tagx` extension are +little packaging. Only files with a `.tag` or `.tagx` extension are recognized by the container to be tag files. Tag files that appear in any other location @@ -8219,12 +8255,12 @@ To be accessible, tag files bundled in a `JAR` require a Tag Library Descriptor. Tag files that appear in a JAR but are not defined in a TLD must be ignored by the JSP container. -JSP 2.0 adds an additional TLD element to -describe tags within a tag library, namely `` . The +JSP 2.0 added an additional TLD element to +describe tags within a tag library, namely ``. The `` element requires `` and `` subelements, which define the tag name and the full path of the tag file from the root of the JAR, respectively. In a JAR file, the `` element must always -begin with `/META-INF/tags` . The values for the other subelements of +begin with `/META-INF/tags`. The values for the other subelements of `` override the defaults specified in the tag directive. Tag files packaged in a JAR inherit the JSP version of the TLD that references them. @@ -8266,20 +8302,21 @@ contains three tag libraries: /WEB-INF/tags/bar/baz/d.tag The JSP container must generate an implicit -tag library for each directory under and including `/WEB-INF/tags/` . +tag library for each directory under and including `/WEB-INF/tags/`. This tag library can be imported only via the `tagdir` attribute of the -`taglib` directive (see <>), and has the following hard-wired values: +`taglib` directive (see <>), and has the following +hard-wired values: -* `` for the tag library +* `` for the tag library defaults to 1.0 -* `` is derived from the -directory name. If the directory is `/WEB-INF/tags/` , the short name is -simply `tags` . Otherwise, the full directory path (relative to the web +* `` is derived from the +directory name. If the directory is `/WEB-INF/tags/`, the short name is +simply `tags`. Otherwise, the full directory path (relative to the web application) is taken, minus the `/WEB-INF/tags/` prefix. Then, all `/` -characters are replaced with `-` , which yields the short name. Note +characters are replaced with `-`, which yields the short name. Note that short names are not guaranteed to be unique (as in `/WEB-INF/tags/` versus `/WEB-INF/tags/tags/` or `/WEB-INF/tags/a-b/` versus -`/WEB-INF/tags/a/b/` ) +`/WEB-INF/tags/a/b/`) * A `` element is considered to exist for each tag file in this directory, with the following sub-elements: @@ -8306,7 +8343,7 @@ defaults to 2.0. The JSP version and tlib-version of an implicit tag library may be configured by placing a TLD with the reserved name implicit.tld in the same directory as the implicit tag -library’s constituent tag files. A JSP 2.1 container must consider only +library’s constituent tag files. A JSP 2.1 onwards container must consider only the JSP version and tlib-version specified by an implicit.tld file, and ignore its short-name element. Any additional elements in an implicit.tld file must cause a translation error. The JSP version @@ -8319,7 +8356,7 @@ subdirectories. In processing a tag file, the container makes the custom actions defined in these tags available to JSP files. If a directory contains two files with the -same tag name (e.g. `a.tag` and `a.tagx` ), it is considered to be the +same tag name (e.g. `a.tag` and `a.tagx`), it is considered to be the same as having a TLD file with two `` elements whose `` sub-elements are identical. The tag library is therefore considered invalid. @@ -8329,7 +8366,7 @@ library, a Tag Library Descriptor in the web application can still create additional tags from the same tag files. This is accomplished by adding a `` element with a `` that points to the tag file. In this case, the value of `` must start with -`/WEB-INF/tags` . It a tag file is referenced by both a TLD as well as +`/WEB-INF/tags`. It a tag file is referenced by both a TLD as well as an implicit TLD, the JSP versions of the TLD and implicit TLD do not need to match. @@ -8362,7 +8399,7 @@ outlines which directives are available in tag files: |`page` |no -|A tag file is not a `page` . The `tag` +|A tag file is not a `page`. The `tag` directive must be used instead. If this directive is used in a tag file, a translation error must result. @@ -8417,31 +8454,31 @@ fatal translation errors. _Examples_ - <%@ tag display-name=”Addition” - body-content=”scriptless” - dynamic-attributes=”dyn” - small-icon=”/WEB-INF/sample-small.jpg” - large-icon=”/WEB-INF/sample-large.jpg” - description=”Sample usage of tag directive” %> + <%@ tag display-name="Addition" + body-content="scriptless" + dynamic-attributes="dyn" + small-icon="/WEB-INF/sample-small.jpg" + large-icon="/WEB-INF/sample-large.jpg" + description="Sample usage of tag directive" %> _Syntax_ .... <%@ tag tag_directive_attr_list %> -tag_directive_attr_list ::= { display-name=”display-name” } - { body-content=”scriptless|tagdependent|empty” } - { dynamic-attributes=”name” } - { small-icon=”small-icon” } - { large-icon=”large-icon” } - { description=”description” } - { example=”example” } - { language=”scriptingLanguage” } - { import=”importList” } - { pageEncoding=”peinfo” } - { isELIgnored=”true|false” } - { deferredSyntaxAllowedAsLiteral=”true|false” } - { trimDirectiveWhitespaces=”true|false” } +tag_directive_attr_list ::= { display-name="display-name" } + { body-content="scriptless|tagdependent|empty" } + { dynamic-attributes="name" } + { small-icon="small-icon" } + { large-icon="large-icon" } + { description="description" } + { example="example" } + { language="scriptingLanguage" } + { import="importList" } + { pageEncoding="peinfo" } + { isELIgnored="true|false" } + { deferredSyntaxAllowedAsLiteral="true|false" } + { trimDirectiveWhitespaces="true|false" } .... The details of the attributes are as follows: @@ -8458,9 +8495,9 @@ be displayed by tools. Defaults to the name of the tag file, without the |`body-content` |(optional) Provides information on the -content of the body of this tag. Can be either `empty` , `tagdependent` -, or `scriptless` . A translation error will result if `JSP` or any -other value is used. Defaults to `scriptless` . +content of the body of this tag. Can be either `empty`, `tagdependent` +, or `scriptless`. A translation error will result if `JSP` or any +other value is used. Defaults to `scriptless`. |`dynamic-attributes` |(optional) The presence of this attribute @@ -8468,7 +8505,7 @@ indicates this tag supports additional attributes with dynamic names. If present, the generated tag handler must implement the `jakarta.servlet.jsp.tagext.DynamicAttributes` interface, and the container must treat the tag as if its corresponding TLD entry contained -`true` . The implementation +`true`. The implementation must not reject any attribute names. The value identifies a page scoped attribute in which to place a `Map` containing the names and values of the dynamic attributes passed during this invocation. The `Map` must @@ -8512,23 +8549,25 @@ semantics of the import attribute of the page directive. |(optional) Carries the same syntax and semantics of the `pageEncoding` attribute in the `page` directive. However, there is no corresponding global configuration element in -`web.xml` . The `pageEncoding` attribute cannot be used in tag files in +`web.xml`. The `pageEncoding` attribute cannot be used in tag files in XML syntax. |`isELIgnored` |(optional) Carries the same syntax and semantics of the `isELIgnored` attribute of the `page` directive. However, there is no corresponding global configuration element in -`web.xml` . +`web.xml`. -|`deferredSyntaxAllowedAsLiteral` +|`deferredSyntax-` + +`AllowedAsLiteral` |(optional) Carries the same syntax and semantics of the deferredSyntaxAllowedAsLiteral attribute of the `page` directive. However, there is no corresponding global configuration -element in `web.xml` . Causes a translation error if specified in a tag +element in `web.xml`. Causes a translation error if specified in a tag file with a JSP version less than 2.1. -|`trimDirectiveWhitespaces` +|`trimDirective-` + +`Whitespaces` |(optional) Carries the same syntax and semantics of the trimDirectiveWhitespaces attribute of the `page` directive. However, there is no corresponding global configuration @@ -8544,29 +8583,29 @@ declaration of custom action attributes. _Examples_ - <%@ attribute name=”x” required=”true” fragment=”false” - rtexprvalue=”false” type=”java.lang.Integer” - description=”The first operand” %> + <%@ attribute name="x" required="true" fragment="false" + rtexprvalue="false" type="java.lang.Integer" + description="The first operand" %> - <%@ attribute name=”y” type=”java.lang.Integer” %> + <%@ attribute name="y" type="java.lang.Integer" %> - <%@ attribute name=”prompt” fragment=”true” %> + <%@ attribute name="prompt" fragment="true" %> _Syntax_ .... <%@ attribute attribute_directive_attr_list %> -attribute_directive_attr_list ::= name=”attribute-name” - { required=”true|false” } - { fragment=”true|false” } - { rtexprvalue=”true|false” } - { type=”type” } - { description=”description” } - { deferredValue=”true|false” } - { deferredValueType=”type” } - { deferredMethod=”true|false” } - { deferredMethodSignature=”signature” } +attribute_directive_attr_list ::= name="attribute-name" + { required="true|false" } + { fragment="true|false" } + { rtexprvalue="true|false" } + { type="type" } + { description="description" } + { deferredValue="true|false" } + { deferredValueType="type" } + { deferredMethod="true|false" } + { deferredMethodSignature="signature" } .... The details of the attributes are as follows: @@ -8581,31 +8620,31 @@ _Details of `attribute` directive attributes_ |(required) The unique name of the attribute being declared. A translation error must result if more than one `attribute` directive appears in the same translation unit with the same -`name` . A translation error will result if there is an `attribute` +`name`. A translation error will result if there is an `attribute` directive with a `name` attribute equal to the value of the `name-given` attribute of a `variable` directive or the `dynamic-attributes` attribute of a `tag` directive in this translation unit. |`required` |(optional) Whether this attribute is required -( `true` ) or optional ( `false` ). Defaults to `false` if not +(`true`) or optional (`false`). Defaults to `false` if not specified. |`fragment` |(optional) Whether this attribute is a -fragment to be evaluated by the tag handler ( `true` ) or a normal +fragment to be evaluated by the tag handler (`true`) or a normal attribute to be evaluated by the container prior to being passed to the -tag handler. If this attribute is `true` , the type attribute is fixed +tag handler. If this attribute is `true`, the type attribute is fixed at `jakarta.servlet.jsp.tagext.JspFragment` and a translation error will result if the `type` attribute is specified. Also, if this -attribute is `true` , the `rtexprvalue` attribute is fixed at `true` and +attribute is `true`, the `rtexprvalue` attribute is fixed at `true` and a translation error will result if the `rtexprvalue` attribute is -specified. Defaults to `false` . +specified. Defaults to `false`. |`rtexprvalue` |(optional) Whether the attribute’s value may be dynamically calculated at runtime by a scriptlet expression. Unlike -the corresponding TLD element, this attribute defaults to `true` . +the corresponding TLD element, this attribute defaults to `true`. |`type` |(optional) The runtime type of the @@ -8638,13 +8677,14 @@ represents a deferred method expression. Only one of `deferredValue` or default is true, otherwise default is false. Causes a translation error if specified in a tag file with a JSP version less than 2.1. -|`deferredMethodSignature` +|`deferredMethod-` + +`Signature` |(optional) The signature, as defined in the Java Language Specification, of the method to be invoked in the attribute's method expression. If both `deferredMethod` and `deferredMethodSignature` are specified, `deferredMethod` must be true. If `deferredMethod` is true and `deferredMethodSignature` is not -specified, it defaults to `void methodname()` . Causes a translation +specified, it defaults to `void methodname()`. Causes a translation error if specified in a tag file with a JSP version less than 2.1. |=== @@ -8660,39 +8700,39 @@ See <> for more details. _Examples_ - <%@ variable name-given=”sum” - variable-class=”java.lang.Integer” - scope=”NESTED” - declare=”true” - description=”The sum of the two operands” %> + <%@ variable name-given="sum" + variable-class="java.lang.Integer" + scope="NESTED" + declare="true" + description="The sum of the two operands" %> - <%@ variable name-given=”op1” - variable-class=”java.lang.Integer” - description=”The first operand” %> + <%@ variable name-given="op1" + variable-class="java.lang.Integer" + description="The first operand" %> - <%@ variable name-from-attribute=”var” alias=”result” %> + <%@ variable name-from-attribute="var" alias="result" %> _Syntax_ .... <%@ variable variable_directive_attr_list %> -variable_directive_attr_list ::= ( name-given=”output-name” - | ( name-from-attribute=”attr-name” - alias=”local-name” + +variable_directive_attr_list ::= ( name-given="output-name" + | ( name-from-attribute="attr-name" + alias="local-name" + ) ) - { variable-class=”output-type” } - { declare=”true|false” } - { scope=”AT_BEGIN|AT_END|NESTED” } - { description=”description” } + { variable-class="output-type" } + { declare="true|false" } + { scope="AT_BEGIN|AT_END|NESTED" } + { description="description" } .... The details of the attributes are as follows: _Details of `variable` directive attributes_ -[cols="30,70"] +[cols="25,75"] |=== |`name-given` @@ -8700,7 +8740,7 @@ _Details of `variable` directive attributes_ the page invoking this tag. Either the `name-given` attribute or the `name-from-attribute` attribute must be specified. Specifying neither or both will result in a translation error. A translation error will result -if two `variable` directives have the same `name-given` . A translation +if two `variable` directives have the same `name-given`. A translation error will result if there is a `variable` directive with a `name-given` attribute equal to the value of the `name` attribute of an `attribute` directive or the `dynamic-attributes` attribute of a `tag` directive in @@ -8713,25 +8753,25 @@ attribute whose (translation-time) value at of the start of the tag invocation will give the name of the variable. A translation error will result if there is no `attribute` directive with a `name` attribute equal to the value of this attribute that is of type `java.lang.String` -, is `required` and not an `rtexprvalue` . Either the `name-given` +, is `required` and not an `rtexprvalue`. Either the `name-given` attribute or the `name-from-attribute` attribute must be specified. Specifying neither or both will result in a translation error. A translation error will result if two variable directives have the same -`name-from-attribute` . +`name-from-attribute`. |`alias` |Defines a locally scoped attribute to hold the value of this variable. The container will synchronize this value -with the variable whose name is given in `name-from-attribute` . +with the variable whose name is given in `name-from-attribute`. Required when `name-from-attribute` is specified. A translation error -must occur if used without `name-from-attribute` . A translation error +must occur if used without `name-from-attribute`. A translation error must occur if the value of `alias` is the same as the value of a `name` attribute of an `attribute` directive or the `alias or name-given` attribute of a `variable` directive in the same translation unit. |`variable-class` |(optional) The name of the class of the -variable. The default is `java.lang.String` . +variable. The default is `java.lang.String`. |`declare` |(optional) Whether the variable is declared @@ -8740,8 +8780,8 @@ is the default. |`scope` |(optional) The scope of the scripting -variable defined. Can be either `AT_BEGIN` , `AT_END` , or `NESTED` . -Defaults to `NESTED` . +variable defined. Can be either `AT_BEGIN`, `AT_END`, or `NESTED`. +Defaults to `NESTED`. |`description` |(optional) An optional description of this @@ -8757,7 +8797,7 @@ This section describes the few distinctions from the case of JSP documents. Tag files in XML syntax must have the -extension `.tagx` . All files with extension `.tagx` according to the +extension `.tagx`. All files with extension `.tagx` according to the rules in <> are tag files in XML syntax. Conversely, files with extension `.tag` are not in XML syntax. @@ -8766,7 +8806,7 @@ The `jsp:root` element can, but needs not, appear in tag files in XML syntax. A `jsp:root` element cannot appear in a tag file in JSP syntax. -As indicated in <<_jsp:output>>, the default for tag +As indicated in <>, the default for tag files, in either syntax, is not to generate the xml declaration. The element `jsp:output` can be used to change that default for tag files in XML syntax. @@ -8804,7 +8844,7 @@ shown in <<_Implicit_Objects_Available_in_Tag_Files>>. [[_Implicit_Objects_Available_in_Tag_Files]] .Implicit Objects Available in Tag Files -[cols="20,50,30",options="header"] +[cols="15,45,40",options="header"] |=== |Variable Name @@ -8858,8 +8898,8 @@ configuration object (as in the call |=== -Object names with prefixes `jsp`, `jsp` , -`jspx` and `jspx` , in any combination of upper and lower case, are +Object names with prefixes `jsp`, `jsp`, +`jspx` and `jspx`, in any combination of upper and lower case, are reserved by the JSP specification. === Variable Synchronization @@ -8881,7 +8921,7 @@ referring to a constant name in the tag file. When using these attributes, the name of the variable in the calling page is derived from the value of `name-from-attribute` at the time the tag was called. The name of the corresponding variable in the tag file is the value of -`alias` . +`alias`. * IN parameters - Use attributes. For each attribute, a page-scoped attribute is made available in the `JspContext` @@ -8889,19 +8929,19 @@ of the tag file. The page-scoped attribute is initialized to the value of the attribute when the tag is called. No further synchronization is performed. * OUT parameters - Use variables with scope -`AT_BEGIN` or `AT_END` . For each `AT_BEGIN` or `AT_END` variable, a +`AT_BEGIN` or `AT_END`. For each `AT_BEGIN` or `AT_END` variable, a page-scoped attribute is made available in the `JspContext` of the tag file. The scoped attribute is not initialized. Synchronization is performed at the end of the tag for `AT_BEGIN` and `AT_END` and also -before the invocation of a fragment for `AT_BEGIN` . See +before the invocation of a fragment for `AT_BEGIN`. See <<_Variable_synchronization_behavior>> for details. * Nested parameters - Use variables with -scope `AT_BEGIN` or `NESTED` . For each `AT_BEGIN` or `NESTED` variable, +scope `AT_BEGIN` or `NESTED`. For each `AT_BEGIN` or `NESTED` variable, a page-scoped attribute is made available in the `JspContext` of the tag file. The scoped attribute is not initialized. Synchronization is -performed before each fragment invocation for `AT_BEGIN` and `NESTED` , -and also after the end of the tag for `AT_BEGIN` . See +performed before each fragment invocation for `AT_BEGIN` and `NESTED`, +and also after the end of the tag for `AT_BEGIN`. See <<_Variable_synchronization_behavior>> for details. @@ -8948,7 +8988,7 @@ The following list describes what each synchronization action means. If `name-given` is used, the name of the variable in the calling page (referred to as P) and the name of the variable in the tag file (referred to as T) are the same and are equal -to the value of `name-given` . If `name-from-attribute` is used, the +to the value of `name-given`. If `name-from-attribute` is used, the name of P is equal to the value of the attribute (at the time the page was called) specified by the value of `name-from-attribute` and the name of T is equal to the value of the `alias` attribute. @@ -8988,24 +9028,24 @@ calling page at the end of the tag invocation. .... <%-- page.jsp --%> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> -<%@ taglib prefix=”my” tagdir=”/WEB-INF/tags” %> - +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> + ${x} <%-- (x == 1) --%> ${x} <%-- (x == 2) --%> - + ${x} <%-- (x == 4) --%> <%-- /WEB-INF/tags/example.tag --%> -<%@ variable name-given=”x” scope=”AT_BEGIN” %> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> +<%@ variable name-given="x" scope="AT_BEGIN" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> ${x} <%-- (x == null) --%> - + ${x} <%-- (x == 2) --%> - + .... ===== Example of AT_BEGIN and name-from-attribute @@ -9017,33 +9057,33 @@ The name of the attribute is customized via `name-from-attribute`. .... <%-- page.jsp --%> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> -<%@ taglib prefix=”my” tagdir=”/WEB-INF/tags” %> - +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> + ${x} <%-- (x == 1) --%> - + ${x} <%-- (x == 2) --%> ${result} <%-- (result == null) --%> - - + + ${x} <%-- (x == 4) --%> -${result} <%-- (result == ‘invisible’) --%> +${result} <%-- (result == 'invisible') --%> <%-- /WEB-INF/tags/example.tag --%> -<%@ attribute name=”var” required=”true” rtexprvalue=”false”%> -<%@ variable alias=”result” name-from-attribute=”var” scope=”AT_BEGIN” +<%@ attribute name="var" required="true" rtexprvalue="false"%> +<%@ variable alias="result" name-from-attribute="var" scope="AT_BEGIN" %> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> ${x} <%-- (x == null) --%> ${result} <%-- (result == null) --%> - - + + -${x} <%-- (x == ‘ignored’) --%> +${x} <%-- (x == 'ignored') --%> ${result} <%-- (result == 2) --%> - - + + .... ===== Example of NESTED @@ -9054,24 +9094,24 @@ value is restored when the tag is done. .... <%-- page.jsp --%> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> -<%@ taglib prefix=”my” tagdir=”/WEB-INF/tags” %> - +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> + ${x} <%-- (x == 1) --%> ${x} <%-- (x == 2) --%> - + ${x} <%-- (x == 1) --%> <%-- /WEB-INF/tags/example.tag --%> -<%@ variable name-given=”x” scope=”NESTED” %> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> +<%@ variable name-given="x" scope="NESTED" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> ${x} <%-- (x == null) --%> - + ${x} <%-- (x == 2) --%> - + .... ===== Example of AT_END @@ -9081,24 +9121,24 @@ return a value to the page. The body of the tag is not affected. .... <%-- page.jsp --%> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> -<%@ taglib prefix=”my” tagdir=”/WEB-INF/tags” %> - +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> + ${x} <%-- (x == 1) --%> ${x} <%-- (x == 1) --%> - + ${x} <%-- (x == 4) --%> <%-- /WEB-INF/tags/example.tag --%> -<%@ variable name-given=”x” scope=”AT_END” %> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> +<%@ variable name-given="x" scope="AT_END" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> ${x} <%-- (x == null) --%> - + ${x} <%-- (x == 2) --%> - + .... ===== Example of Removing Parameters @@ -9109,25 +9149,25 @@ synchronization. .... <%-- page.jsp --%> -<%@ taglib prefix=”my” tagdir=”/WEB-INF/tags” %> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> - +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + ${x} - ‘${x}’ + '${x}' ${x} <%-- /WEB-INF/tags/example.tag --%> -<%@ variable name-given=”x” scope=”NESTED” %> -<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> - +<%@ variable name-given="x" scope="NESTED" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + - + .... -The expected output of this example is: 2 ‘1’ ‘’ 2 +The expected output of this example is: 2 '1' '' 2 == Scripting @@ -9157,14 +9197,18 @@ complete language statements. ==== Valid JSP Page A JSP page is valid for a Java Platform if and -only if the JSP page implementation class defined by <<_Structure_of_the_Java_Programming_Language_Class>> (after applying all include directives), together with any other classes defined by the JSP container, is a valid program for the given Java Platform, and if it passes the validation methods for all the tag libraries associated with the JSP page. +only if the JSP page implementation class defined by +<<_Structure_of_the_Java_Programming_Language_Class>> (after applying all +include directives), together with any other classes defined by the JSP +container, is a valid program for the given Java Platform, and if it passes +the validation methods for all the tag libraries associated with the JSP page. ==== Reserved Names -Sun Microsystems reserves all names of the -form `{\_}jsp_*` and `{\_}jspx_*` , in any combination of upper and -lower case, for the JSP specification. Names of this form that are not -defined in this specification are reserved for future expansion. +All names of the form `{\_}jsp_*` and `{\_}jspx_*`, in any combination +of upper and lower case, are reserved for the JSP specification. Names +of this form that are not defined in this specification are reserved +for future expansion. ==== Implementation Flexibility @@ -9184,7 +9228,7 @@ other implementation attributes. |`SuperClass` is either selected by the JSP container or by the JSP author via the `jsp` directive. + -Name of class ( ``jspXXX` ) is implementation +Name of class (`jspXXX`) is implementation dependent. |`class jspXXX extends SuperClass` @@ -9193,7 +9237,7 @@ implementation class |`{` |(1) Declaration Section -|`// declarations...` +|`// declarations\...` |signature for generated method |`public void @@ -9211,7 +9255,7 @@ request, response, page, pageContext etc.` |close of `jspService` method |`}` -|close of ``jspXXX` +|close of `jspXXX` |`}` |=== @@ -9283,7 +9327,7 @@ fragment.: An expression is transformed into a Java statement to insert the value of the expression, converted to `java.lang.String` if needed, into the stream named by the implicit -variable `out` . No additional newlines or space is included. +variable `out`. No additional newlines or space is included. Ignoring quotation and performance issues, this corresponds to a statement of the form: @@ -9340,7 +9384,7 @@ references to the object denoted by the variable. This chapter provides details on the XML view of a JSP page and tag files. The XML views are used to enable -validation of JSP pages and tag files.. +validation of JSP pages and tag files. === XML View of a JSP Document, JSP Page or Tag File @@ -9355,17 +9399,17 @@ file written in XML syntax is very close to the original JSP page. Only five transformations are performed: * Expand all include directives into the JSP -content they include. See <> for the semantics of mixing XML and standard syntax -content. +content they include. See <> for the +semantics of mixing XML and standard syntax content. * Add a `jsp:root` element as the root element if the JSP document or tag file in XML syntax does not have it. * Set the value of the `pageEncoding` -attribute of the page directive to " `UTF-8` ". The `page` directive and +attribute of the page directive to "`UTF-8`". The `page` directive and the `pageEncoding` attribute are added if they don’t exist already. * Set the value of the `contentType` attribute of the `page` directive to the value that the container will -pass to `ServletResponse.setContentType()` , determined as described in -/C:/jspspec/JSP`I18N.html#52032[]. The `page` directive and the +pass to `ServletResponse.setContentType()`, determined as described in +<>. The `page` directive and the `contentType` attribute are added if they don’t exist already. * Add the `jsp:id` attribute (see <>). @@ -9376,7 +9420,7 @@ The XML view of a JSP page or tag file written in standard syntax is defined by the following transformation: * Expand all include directives into the JSP -content they include. See /C:/jspspec/JSP`Syntax.html#30346[] for the +content they include. See <> for the semantics of mixing XML and standard syntax content. * Add a `jsp:root` element as the root, with appropriate `xmlns:jsp` attribute, and convert the `taglib` directive @@ -9408,52 +9452,52 @@ shown in <<_XML_View_Transformations>>: |`<%-- comment --%>` |removed -|`<%@ page ... %>` -|`` . Add `jsp:id` +|`<%@ page \... %>` +|``. Add `jsp:id` -|`<%@ taglib ... %>` +|`<%@ taglib \... %>` |`jsp:root` element is annotated with namespace information. Add `jsp:id`. -|`<%@ include ... %>` +|`<%@ include \... %>` |`expanded in place` -|`<%! ... %>` +|`<%! \... %>` -|` ... `. +|` \... `. Add `jsp:id`. -|`<% ... %>` +|`<% \... %>` -|` ... `. +|` \... `. Add `jsp:id`. -|`<%= ... %>` -|` ... `. +|`<%= \... %>` +|` \... `. Add `jsp:id`. |Standard action |Replace with XML syntax (adjust request-time -expressions; add `jsp:id` ) +expressions; add `jsp:id`) |Custom action |As is (adjust request-time expressions; add -`jsp:id` ) +`jsp:id`) |template |Replace with `jsp:text`. Add `jsp:id`. -|`<%@ tag ... %>` -|``. Add +|`<%@ tag \... %>` +|``. Add `jsp:id.` [tag files only] -|`<%@ attribute ... %>` -|``. +|`<%@ attribute \... %>` +|``. Add `jsp:id.` [tag files only] -|`<%@ variable ... %>` -|`` . +|`<%@ variable \... %>` +|``. Add `jsp:id.` [tag files only] |=== @@ -9469,14 +9513,14 @@ passed through to the XML view of a JSP page. A `page` directive of the form: - <%@ page { attr=”value” }* %> + <%@ page { attr="value" }* %> is translated into an element of the form: - + The value of the `pageEncoding` attribute is -set to " `UTF-8` ". The value of the `contentType` attribute is set to +set to "`UTF-8`". The value of the `contentType` attribute is set to the value that the container will pass to ServletResponse.setContentType(), determined as described in /C:/jspspec/JSP`I18N.html#52032[]. The `page` directive and both @@ -9486,16 +9530,16 @@ attributes are added if they don’t exist already. A taglib directive of the form - <%@ taglib uri=”uriValue” prefix=”prefix” %> + <%@ taglib uri="uriValue" prefix="prefix" %> is translated into an `xmlns:prefix` attribute on the root of the JSP document, with a value that depends on -`uriValue` . If `uriValue` is a relative path, then the value used is +`uriValue`. If `uriValue` is a relative path, then the value used is `urn:jsptld:` `uriValue` ; otherwise, the `uriValue` is used directly. A taglib directive of the form - <%@ taglib tagdir=”tagDirValue” prefix=”prefix” %> + <%@ taglib tagdir="tagDirValue" prefix="prefix" %> is translated into an `xmlns:prefix` attribute on the root of the JSP document, with a value of the form @@ -9505,7 +9549,7 @@ attribute on the root of the JSP document, with a value of the form An include directive of the form - <%@ include file=”value” %> + <%@ include file="value" %> is expanded into the JSP content indicated by `value`. This is done to allow for validation of the page. @@ -9513,20 +9557,20 @@ is expanded into the JSP content indicated by ==== Declarations Declarations are translated into a -`jsp:declaration` element. For example, the second example from +<> element. For example, the second example from /C:/jspspec/JSP`Syntax.html#36319[]: - <%! public String f(int i) { if (i<3) return(“...”); ... } %> + <%! public String f(int i) { if (i<3) return("..."); ... } %> is translated into the following. - + -Alternatively, we could use an `<` and +Alternatively, we could use an `&lt;` and instead say: - public String f(int i) {if (i<3) return(“...”); } + public String f(int i) {if (i<3) return("..."); } ==== Scriptlets @@ -9553,29 +9597,31 @@ conventions and the syntax of request-time attribute expressions. ==== Request-Time Attribute Expressions Request-time attribute expressions are of the -form `<%= expression %>` . Although this syntax is consistent with the +form `<%= expression %>`. Although this syntax is consistent with the syntax used elsewhere in a JSP page, it is not a legal XML syntax. The XML mapping for these expressions is into values of the form `%= -expression %` , where the JSP specification quoting convention has been +expression %`, where the JSP specification quoting convention has been converted to the XML quoting convention. Request-time attribute values can also be -specified using EL expressions of the form `${expression}` . +specified using EL expressions of the form `${expression}`. Expressions of this form are represented verbatim in the XML view. The XML view of an escaped EL expression using the ${expr} syntax can be obtained as follows: * The XML view of an unescaped expression -`${foo}` is `${foo}` . +`${foo}` is `${foo}`. * The XML view of an escaped expression -`\${foo}` is `\${foo}` . +`\${foo}` is `\${foo}`. * For each escaped `\` preceeding an -unescaped expression `${foo}` , a `${’\\’}` must be generated in the -XML view, and neighboring generated `${’\\’}` expressions must be +unescaped expression `${foo}`, a `${'\\'}` must be generated in the +XML view, and neighboring generated `${'\\'}` expressions must be combined. -<<_XML_View_of_an_Escaped_EL_Expression_in_a_Request_time_Attribute_Value>> illustrates these rules. Assume the EL expression `${foo}` evaluates to `[bar]` and that EL is enabled for this translation unit. +<<_XML_View_of_an_Escaped_EL_Expression_in_a_Request_time_Attribute_Value>> +illustrates these rules. Assume the EL expression `${foo}` evaluates to `[bar]` +and that EL is enabled for this translation unit. [[_XML_View_of_an_Escaped_EL_Expression_in_a_Request_time_Attribute_Value]] .XML View of an Escaped EL Expression in a Request-time Attribute Value @@ -9595,7 +9641,7 @@ combined. |`${foo}` |`\\${foo}` -|`${’\\’}${foo}` +|`${'\\'}${foo}` |`\[bar]` |`\\\${foo}` @@ -9603,7 +9649,7 @@ combined. |`\${foo}` |`\\\\${foo}` -|`${’\\\\’}${foo}` +|`${'\\\\'}${foo}` |`\\[bar]` |`\\\\\${foo}` @@ -9611,7 +9657,7 @@ combined. |`\\${foo}` |`\\\\\\${foo}` -|`${’\\\\\\’}${foo}` +|`${'\\\\\\'}${foo}` |`\\\[bar]` |... @@ -9622,14 +9668,14 @@ combined. The XML view of an escaped EL expression using the `\#{expr}` syntax follows the same rules as the `${expr}` -syntax, where `${` is simply substituted with `#{` . +syntax, where `${` is simply substituted with `#{`. ==== Template Text and XML Elements All text that is uninterpreted by the JSP translator is converted into the body for a `jsp:text` element. As a consequence no XML elements of the form described in -JSPDocuments.html#16239[] will appear in the XML view of a +<