Java Reference
In-Depth Information
Table 3-8.
<c:out> Attributes
Name
Type
Description
value
Object
This is the expression to be evaluated.
escapeXml
boolean
This determines whether the characters <,>,&,',” in the
resulting string should be converted to their corresponding
character entity codes. The default value is
true
.
default
Object
This is the default value if the resulting value is
null
.
The value to be written to the
JspWriter
is specified as a
value
attribute. You can use expressions in
the
value
attribute.
value
: The expression to be evaluated is supplied via the
value
attribute,
and the result is converted into a string before being returned as part of the
response.
default
: You can optionally specify a default value that
<c:out>
sends to the
current
JspWriter
if the specified value is
null
or is not a valid expression. You
can specify the default value with the default attribute or in the body of the
<c:out>
action.
escapeXml
: The
escapeXml
attribute specifies whether to convert certain
characters to the HTML character entity codes listed in Table
3-9
. By default, the
escapeXml
attribute is set to
true
. If you specify
false
for the
escapeXml
attribute,
<c:out>
will not convert these characters.
Table 3-9.
Character Entity Codes
Character
Character Entity Code
<
<
>
>
&
&
'
'
"
"
Listing 3-35 illustrates replacing scripting elements with the
<c:out>
action.
Listing 3-35. Comparing <c:out> and Expression
<%= "hello" %> // Ouput "hello" using Expression
<c:out value = "hello"/> // Ouput "hello" using <c:out> action