📄 struts-bean.html
字号:
value or multiple values, depending on the <code>multiple</code> attribute),
and define the result as a page scope attribute of type <code>String</code>
(if <code>multiple</code> is not specified) or <code>String[]</code>
(if <code>multiple</code> is specified).</p>
<p>If no request parameter with the specified name can be located, and
no default value is specified, a request time exception will be thrown.</p>
<table class="tag-attributes">
<thead>
<tr>
<th class="attribute">Attribute Name</th>
<th>Description</th>
</tr>
</thead>
<tr class="evenRow">
<td align="center">id</td>
<td>
<p>Specifies the name of the scripting variable (and associated page
scope attribute) that will be made available with the value of the
specified request parameter.</p>
[Required]
</td>
</tr>
<tr class="oddRow">
<td align="center">multiple</td>
<td>
<p>If any arbitrary value for this attribute is specified, causes a call
to <code>ServletRequest.getParameterValues()</code> and a definition of
the result as a bean of type <code>String[]</code>. Otherwise,
<code>ServletRequest.getParameter()</code> will be called, and a
definition of the result as a bean of type <code>String</code>
will be performed.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">name</td>
<td>
<p>Specifies the name of the request parameter whose value, or values,
is to be retrieved.</p>
[Required]
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">value</td>
<td>
<p>The default parameter value to return if no parameter with the
specified name was included in this request.</p>
[RT Expr]
</td>
</tr>
</table>
</div>
<p>
<a href="#top">Back to top</a>
</p>
<h3 id="resource">
<strong>resource</strong> -
Load a web application resource and make it available as a bean.
</h3>
<div class="indent">
<p>Retrieve the value of the specified web application resource, and make
it available as either a <code>InputStream</code> or a <code>String</code>,
depending on the value of the <code>input</code> attribute.</p>
<p>If a problem occurs while retrieving the specified resource, a
request time exception will be thrown.</p>
<table class="tag-attributes">
<thead>
<tr>
<th class="attribute">Attribute Name</th>
<th>Description</th>
</tr>
</thead>
<tr class="evenRow">
<td align="center">id</td>
<td>
<p>Specifies the name of the scripting variable (and associated page
scope attribute) that will be made available with the value of the
specified web application resource.</p>
[Required]
</td>
</tr>
<tr class="oddRow">
<td align="center">input</td>
<td>
<p>If any arbitrary value for this attribute is specified, the resource
will be made available as an <code>InputStream</code>. If this
attribute is not specified, the resource will be made available
as a <code>String</code>.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">name</td>
<td>
<p>Module-relative name (starting with a '/') of the web application
resource to be loaded and made available.</p>
[Required]
[RT Expr]
</td>
</tr>
</table>
</div>
<p>
<a href="#top">Back to top</a>
</p>
<h3 id="size">
<strong>size</strong> -
Define a bean containing the number of elements in a Collection or Map.
</h3>
<div class="indent">
<p>Given a reference to an array, Collection or Map, creates a new bean, of
type <code>java.lang.Integer</code>, whose value is the number of elements
in that collection. You can specify the collection to be counted in any
one of the following ways:</p>
<ul>
<li>As a runtime expression specified as the value of the
<code>collection</code> attribute.</li>
<li>As a JSP bean specified by the <code>name</code> attribute.</li>
<li>As the property, specified by the <code>property</code> attribute,
of the JSP bean specified by the <code>name</code> attribute.</li>
</ul>
<table class="tag-attributes">
<thead>
<tr>
<th class="attribute">Attribute Name</th>
<th>Description</th>
</tr>
</thead>
<tr class="evenRow">
<td align="center">collection</td>
<td>
<p>A runtime expression that evaluates to an array, a Collection, or
a Map.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">id</td>
<td>
<p>The name of a page scope JSP bean, of type
<code>java.lang.Integer</code>, that will be created to contain the
size of the underlying collection being counted.</p>
[Required]
</td>
</tr>
<tr class="evenRow">
<td align="center">name</td>
<td>
<p>The name of the JSP bean (optionally constrained to the scope
specified by the <code>scope</code> attribute) that contains the
collection to be counted (if <code>property</code> is not specified),
or whose property getter is called to return the collection to be
counted (if <code>property</code> is specified.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">property</td>
<td>
<p>The name of the property, of the bean specified by the
<code>name</code> attribute, whose getter method will return the
collection to be counted.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">scope</td>
<td>
<p>The bean scope within which to search for the JSP bean specified
by the <code>name</code> attribute. If not specified, the available
scopes are searched in ascending sequence.</p>
[RT Expr]
</td>
</tr>
</table>
</div>
<p>
<a href="#top">Back to top</a>
</p>
<h3 id="struts">
<strong>struts</strong> -
Expose a named Struts internal configuration object as a bean.
</h3>
<div class="indent">
<p>Retrieve the value of the specified Struts internal configuration
object, and define it as a scripting variable and as a page scope
attribute accessible to the remainder of the current page. You must
specify exactly one of the <code>formBean</code>, <code>forward</code>,
and <code>mapping</code> attributes to select the configuration object
to be exposed.</p>
<p>If a problem occurs while retrieving the specified configuration
object, a request time exception will be thrown.</p>
<table class="tag-attributes">
<thead>
<tr>
<th class="attribute">Attribute Name</th>
<th>Description</th>
</tr>
</thead>
<tr class="evenRow">
<td align="center">id</td>
<td>
<p>Specifies the name of the scripting variable (and associated
page scope attribute) that will be made available with the value of
the specified Struts internal configuration object.</p>
[Required]
</td>
</tr>
<tr class="oddRow">
<td align="center">formBean</td>
<td>
<p>Specifies the name of the Struts <code>ActionFormBean</code>
definition object to be exposed.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">forward</td>
<td>
<p>Specifies the name of the global Struts <code>ActionForward</code>
definition object to be exposed.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">mapping</td>
<td>
<p>Specifies the matching path of the Struts <code>ActionMapping</code>
definition object to be exposed.</p>
[RT Expr]
</td>
</tr>
</table>
</div>
<p>
<a href="#top">Back to top</a>
</p>
<h3 id="write">
<strong>write</strong> -
Render the value of the specified bean property to the current
JspWriter.
</h3>
<div class="indent">
<p>Retrieve the value of the specified bean property, and render it to the
current JspWriter as a String by the ways:</p>
<ul>
<li>If <code>format</code> attribute exists then value will be formatted on base of format
string from <code>format</code> attribute and default system locale.</li>
<li>If in resources exists format string for value data type (view <code>format</code>
attribute description) then value will be formatted on base of format string
from resources. Resources bundle and target locale can be specified with
<code>bundle</code> and <code>locale</code> attributes. If nothing specified then
default resource bundle and current user locale will be used.</li>
<li>If there is a PropertyEditor configured for the property value's class, the
<code>getAsText()</code> method will be called.</li>
<li>Otherwise, the usual <code>toString()</code> conversions will be applied.</li>
</ul>
<p>When a format string is provided, numeric values are formatted using the
<code>java.text.DecimalFormat</code> class; if the format string came from
a resource, the <code>applyLocalisedPattern()</code> method is used, and
<code>applyPattern()</code> is used otherwise. Dates are formatted using
the <code>SimpleDateFormat</code> class. For details of the specific format
patterns, please see the Javadocs for those classes.</p>
<p>If a problem occurs while retrieving the specified bean property, a
request time exception will be thrown.</p>
<table class="tag-attributes">
<thead>
<tr>
<th class="attribute">Attribute Name</th>
<th>Description</th>
</tr>
</thead>
<tr class="evenRow">
<td align="center">bundle</td>
<td>
<p>The name of the application scope bean under which the
<code>MessageResources</code> object containing our messages
is stored.</p>
[Globals.MESSAGES_KEY]
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">filter</td>
<td>
<p>If this attribute is set to <code>true</code>, the rendered property
value will be filtered for characters that are sensitive in HTML, and any
such characters will be replaced by their entity equivalents.</p>
[true]
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">format</td>
<td>
<p>Specifies the format string to use to convert bean or property value
to the <code>String</code>. If nothing specified, then default format
string for value data type will be searched in message resources by
according key.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">formatKey</td>
<td>
<p>Specifies the key to search format string in application resources.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">ignore</td>
<td>
<p>If this attribute is set to <code>true</code>, and the bean specified
by the <code>name</code> and <code>scope</code> attributes does not
exist, simply return without writing anything. If this attribute is
set to <code>false</code>, a runtime exception to be thrown,
consistent with the other tags in this tag library.</p>
[false]
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">locale</td>
<td>
<p>The name of the session scope bean under which our currently
selected <code>Locale</code> object is stored.</p>
[Globals.LOCALE_KEY]
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">name</td>
<td>
<p>Specifies the attribute name of the bean whose property is accessed
to retrieve the value specified by <code>property</code> (if
specified). If <code>property</code> is not specified, the value of
this bean itself will be rendered.</p>
[Required]
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">property</td>
<td>
<p>Specifies the name of the property to be accessed on the bean
specified by <code>name</code>. This value may be a simple, indexed,
or nested property reference expression. If not specified, the bean
identified by <code>name</code> will itself be rendered. If the
specified property returns null, no output will be rendered.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">scope</td>
<td>
<p>Specifies the variable scope searched to retrieve the bean specified
by <code>name</code>. If not specified, the default rules applied by
<code>PageContext.findAttribute()</code> are applied.</p>
[RT Expr]
</td>
</tr>
</table>
</div>
<p>
<a href="#top">Back to top</a>
</p>
</div>
<!--end main-->
</div>
<!--end content-->
<div id="footer">
<img id="powered-logo" alt="Powered by Struts" src="../images/struts-power.gif" />
Copyright (c) 2000-2005, The Apache Software Foundation <span class="noprint">-
<a href="http://wiki.apache.org/struts/StrutsDocComments">Comments?</a>
</span>
</div>
<!--end footer-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -