Escolar Documentos
Profissional Documentos
Cultura Documentos
Attribute Description Rqd Default url URL of the resource to Yes None
<fmt:setLocale> - Sets the default locale for the
redirect to. specified scope. This will override the browser-
value URL to be processed. Yes None based locale.
context Name of the context No Current
context Name of the context No Current (beginning with a /) of some context <fmt:setLocale scope="session"
(beginning with a /) of some context other local web application. value="fr_CA">
other local web application.
var Name of the variable to hold No None Attribute Description Rqd Default
the URL as a String. <c:param> - adds request parameters to a URL.
This action can only be nested within value String representation of a Yes None
scope Scope of the var variable No page <c:import>, <c:url>, or locale (e.g. en_US) or an
actual java.util.Locale object.
<c:redirect>.
variant Locale variant (as a String) to No None
Attribute Description Rqd Default specify in conjunction with the
locale (language and country).
name Name of the query string Yes None
parameter. scope Scope to set the default locale No page
for.
value Value of the parameter. If not No Body
specified, value is taken from
the tag body.
<fmt:bundle> - Sets the localization context, based
on the specified resource bundle, to be used within
the body content of this tag.
<fmt:bundle basename="resources"
prefix="label.">
<fmt:message key="userId"/>
<fmt:bundle>
basename Fully-qualified name of the Yes None <fmt:requestEncoding> - Instructs JSTL to use
Attribute Description Rq Default
base bundle without a file type a specific character encoding (see d
(such as “.properties”). http://www.iana.org/assignments/character-sets)
to decode request parameters. Omitting a value value String representation of a time Yes None
var Name of the variable to hold No Default indicates to use automatic detection of the proper zone (such as
the localization context. l10n
context
encoding. “America/New_York”, “GMT-
5”, or “EST”) or an actual
(see java.util.TimeZone object.
“Configu <fmt:requestEncoding key="ISO-8859-1"/>
ration”)
var Name of the variable to store No Default
Attribute Description Rqd Default the time zone. time zone
scope Scope of the var variable No page (see
“Configur
value Character encoding (e.g. “UTF- No Automatic ation”)
8”) to use.
<fmt:message> - Looks up a localized message in a
resource bundle. This tag can contain nested scope Scope of the var variable No page
<fmt:param> tags to specify message format Formatting Actions
substitution values. The resultant message is printed Actions that format and parse numbers,
or stored in a scoped variable. currencies, percentages, dates and times. <fmt:formatNumber> - Formats a number,
<fmt:message key="title"
currency, or percentage in a locale-sensitive manner.
bundle="${strutsResources}"/> <fmt:timeZone> - Sets the specified time zone The formatted value is printed or stored in a scoped
to be applied to the nested body content. The variable.
following example demonstrates that the time
Attribute Description Rqd Default <fmt:formatNumber type="currency"
zone by this action has only nested visibility. value="3.977">
key Message key to be looked up. No Body <jsp:useBean id="now"
class="java.util.Date"/>
<fmt:timeZone Attribute Description Rqd Default
bundle Localization context (set by prio No Default
configuration, <fmt:bundle>, or l10n value="America/Los_Angeles">
<fmt:setBundle>, which specifies context Pacific Time:<fmt:formatDate value Numeric value to No Body
the resource bundle the message type="time" timeStyle="short" format.
key is to be looked up in. value="${now}"/>
</fmt:timeZone>
type Specifies the type of No number
<br/>
var Variable to hold the message. No Local Time:<fmt:formatDate type="time" value. Valid values are:
timeStyle="short" value="${now}"/>
• number
scope Scope of the var variable. No page
• currency
Attribute Description Rqd Default • percentage
currencyCode Currency code (ISO No Based value Value to parse. No Body timeStyle Predefined formatting style for a No default
4217) used for on time (ignored if type=”date”) -- see
formatting currencies. default type Specifies the type of No number java.text.DateFormat.
Such as “USD” (US locale value. Valid values are:
dollars) or “EUR” (euro). Valid values are:
• number • default (2:51:16 PM)
currencySymbol Currency symbol used No Based • currency • short (2:51 PM)
when formatting on • percentage • medium (2:51:16 PM)
currencies. Such as default • long (2:51:16 PM EDT)
“$” for US dollars, or “F” locale pattern Custom parsing pattern No None
for Francs. (overrides type – see • full (2:51:16 PM EDT)
java.text.DecimalFormat) pattern Custom formatting style (overrides No None
groupingUsed Specifies if grouping No true type, dateStyle, and
separators will be used parseLocale String representation of a No Default timeStyle) – see
(for example – locale (e.g. en_US) or an locale java.text.SimpleDateFormat.
formatting “23890” as actual java.util.Locale
“23,890”). object used for parsing. timeZone String representation of a time No Default
zone or an actual time
maxIntegerDigits Maximum number of No None integerOnly Specifies if only the No false java.util.TimeZone object. zone
digits to print in the integer portion of the
integer part of the value should be parsed.
number.
var Variable to store the No None <fmt:formatDate> - Formats a date and/or time in a
minIntegerDigits Minimum number of No None formatted number. locale-sensitive manner. The formatted value is
digits to print in the
integer part of the
printed or stored in a scoped variable.
scope Scope of the var variable No page
number.
<fmt:formatDate value="${now}"
pattern="yy-MMM-dd"/>
maxFractionDigit Maximum number of No None
s digits to print in the Formatting Dates
fractional part of the
Attribute Description Rqd Default
number. Dates are formatted and parsed using the
<fmt:formatDate> and <fmt:parseDate>
minFractionDigit Minimum number of No None value Date value to format. Value No None
actions which share the following common must be a java.util.Date
s digits to print in the
fractional part of the attributes. object.
number.
Attribute Description Rqd Default var Variable to store the No None
var Variable to store the No None formatted number.
formatted number. type Specifies the type of value. Valid No date
values are: scope Scope of the var variable No page
scope Scope of the var No page
• time (time only)
variable
• date (date only)
• both (date and time) <fmt:parseDate> - Parses a string representing a
dateStyle Predefined formatting style for a No default date and/or time in a locale-sensitive manner. The
<fmt:parseNumber> - Parses a String representing date (ignored if type=”time”) -- see parsed value is printed or stored in a scoped
a number, currency, or percentage in a locale- java.text.DateFormat. variable.
sensitive manner. The parsed value is printed or Valid values are:
stored in a scoped variable. • default (Jul 19, 2003)
<fmt:parseDate var="bday"
pattern="MM/dd/yy"
<fmt:parseNumber var="num" type="number"
• short (7/19/03) value="05/10/63"/>
pattern="#,###" value="2,447"/> • medium (Jul 19, 2003) <fmt:formatDate value="${bday}"
<c:out value="${num}"/> • long (July 19, 2003) dateStyle="full"/>
• full (Saturday, July 19,
2003)
Attribute Description Rqd Default Attribute Description Rqd Default
SQL Tag Library
value Date/time string to parse. No None scope Scope of the variable var. No page
maxRows Maximum number of rows to No Default scope Scope of the variable var. No page
return in the result. If not maxRows
specified or set to -1, no limit is (see
enforced. “Configur
ation”) <sql:transaction> - Establishes a database
transaction for <sql:query> and <sql:update>
startRow Returned results include rows No 0 tags contained in this tag's body. That is, all SQL
starting at this index. The first actions contained in the body of this tag will be
row is row 0.
treated as a single atomic transaction. The
var Name of the variable to store the Yes None
transaction will be committed only if all statements
query results. Returned rows are succeed. If any of the contained SQL actions cause
accessible via the rows property an exception, the transaction will be rolled back.
of this object.
Note: this action will reinstate the prior “auto commit”
setting after completion.
<sql:transaction> Attribute Description Rqd Default Attribute Description Rqd Default
<sql:update sql="DELETE users WHERE
user_name='bsiggelkow'"/> user Database user's username No None value Value of the parameter. Yes None
<sql:update sql="INSERT INTO users Must be a java.util.Date
VALUES ('billsigg','Bill','Siggy')"/> object.
</sql:transaction> password Database user's password No None
var Name of the variable to No Default type Indicates how the database No timestamp
hold the data source. data should interpret the value.
Attribute Description Rqd Default
source Valid values are:
name
dataSource Database connection to No Default (see
• date
use. A data “Configur • time
javax.sql.DataSource source ation”) • timestamp
object, or a String (see
representing a JNDI “Configu
resource or the parameters ration”) scope Scope of the variable var. No page
for java.sql.DriverManager.
<sql:param> - Substitutes parameters into SQL
isolation Transaction isolation level. No Databas prepared statement placeholders (“?”). This
Valid values are:
e 's action can only be nested within
default
• read_committed <sql:query> or <sql:update> tags.
• read_uncommitted If the enclosing tag specifies the SQL in the body,
• repeatable_read any <sql:param> tags must appear after the SQL.
• serializable Parameters are substituted in sequential order.
<c:set var="firstName">Bill</c:set>
<sql:query var="users">
<sql:setDataSource> - Creates and stores in a SELECT user_name, last_name
scoped variable an SQL data source. This tag FROM users WHERE first_name = ?
cannot have a body. Either the dataSource or url <sql:param value="${firstName}"/>
</sql:query>
attribute must be specified.
<sql:setDataSource var="testDB"
Attribute Description Rqd Default
url="jdbc:mysql://localhost/test,
com.mysql.jdbc.Driver"/>
<sql:query var="users" value Value of the parameter. If not No Body
dataSource="${testDB}"> specified, value is taken from
SELECT * FROM users the tag body.
</sql:query>
filter XML filter to apply. Value should No None • Node or node set –
sum Converts each node in the set to a number,
be of type org.xml.sax.XMLFilter. implementation-
as if by the number() function, adds up the
(node-set): dependent type
numbers and returns the sum.
number var Name of the variable to store the Yes None
results – may be an scope Scope of variable var. No page
implementation-specific object.
General XML Actions scope Scope of the variable var. No page Flow Control Actions
Actions for parsing XML, outputting to the page, and
varDom Name of the variable to store the Yes None Actions for processing markup based on logical and
selecting XML fragments. The examples that follow result – stored as a DOM object. iterative conditions.
demonstrate use of the XML tags for processing Rich
Site Summary (RSS) feeds. RSS has more or less scopeDom Scope to store variable varDOM No page
the following format: in.
<x:if> - Processes the body if select XPath evaluates
to true (following the rules of the boolean() XPath
<?xml version="1.0"?> function).
<rss version="0.91">
<channel> <x:out> - Prints the result of the XPath <x:if select=
"$news//item[contains(description,'Linux')]"> <x:choose> -- Processes the body of the first Attribute Description Rqd Default
Linux is in the news today! enclosed <x:when> tag where the select XPath
</x:if>
expression evaluates to true. If none match then var Name of variable to hold No None
the body of the <x:otherwise> tag (if present) the current item. This
variable has only nested
Attribute Description Rqd Default is processed. visibility.
<web-app>
<x:param> - Sets a transformation parameter that ...
will be passed to stylesheet which declares
parameters using the <xsl:param> tag. The <context-param>
<param-name>
<x:param> tag can only be nested within an javax.servlet.jsp.jstl.fmt.locale
<x:transform> tag. Any <x:param> tags must </param-name>
come after the XML body content of the <param-value>
en_US
<x:transform> tag, if present. </param-value>
</context-param>
...
<x:transform xml="${news}"
</web-app>
xslt="${searchXsl}"/>
<x:param name="searchParam">
Web Services
</x:param>
</x:transform>
Time Zone
Specifies the default time zone to be used by the
formatting tags.
Variable Name javax.servlet.jsp.jstl.fmt.timeZone