📄 struts-bean.html
字号:
<tr class="evenRow">
<td align="center">toScope</td>
<td>
<p>Specifies the variable scope into which the newly defined bean will
be created. If not specified, the bean will be created in
<code>page</code> scope.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">type</td>
<td>
<p>Specifies the fully qualified class name of the value to be exposed
as the <code>id</code> attribute.</p>
[
java.lang.String (if you specify a value
attribute) or java.lang.Object otherwise.
]
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">value</td>
<td>
<p>The <code>java.lang.String</code> value to which the exposed bean
should be set. This attribute is required unless you specify the
<code>name</code> attribute or nested body content.</p>
[RT Expr]
</td>
</tr>
</table>
</div>
<p>
<a href="#top">Back to top</a>
</p>
<h3 id="header">
<strong>header</strong> -
Define a scripting variable based on the value(s) of the specified
request header.
</h3>
<div class="indent">
<p>Retrieve the value of the specified request header (as a single
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 header 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 header.</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>HttpServletRequest.getHeaders()</code> and a definition of the
result as a bean of type <code>String[]</code>. Otherwise,
<code>HttpServletRequest.getHeader()</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 header 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 header value to return if no header 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="include">
<strong>include</strong> -
Load the response from a dynamic application request and make it available
as a bean.
</h3>
<div class="indent">
<p>Perform an internal dispatch to the specified application component
(or external URL)
and make the response data from that request available as a bean of
type <code>String</code>. This tag has a function similar to that of
the standard <code><jsp:include></code> tag, except that the
response data is stored in a page scope attribute instead of being
written to the output stream. If the current request is part of a
session, the generated request for the include will also include the
session identifier (and thus be part of the same session).</p>
<p>The URL used to access the specified application component is
calculated based on which of the following attributes you specify
(you must specify exactly one of them):</p>
<ul>
<li>
<em>forward</em> - Use the value of this attribute as the name
of a global <code>ActionForward</code> to be looked up, and
use the module-relative or context-relative URI found there.</li>
<li>
<em>href</em> - Use the value of this attribute unchanged (since
this might link to a resource external to the application, the
session identifier is <strong>not</strong> included.</li>
<li>
<em>page</em> - Use the value of this attribute as an
module-relative URI to the desired resource.</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">anchor</td>
<td>
<p>Optional anchor tag ("#xxx") to be added to the generated
hyperlink. Specify this value <strong>without</strong> any
"#" character.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">forward</td>
<td>
<p>Logical name of a global <code>ActionForward</code> that contains
the actual content-relative URI of the resource to be included.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">href</td>
<td>
<p>Absolute URL (including the appropriate protocol prefix such as
"http:") of the resource to be included. Because this URL could be
external to the current web application, the session identifier will
<strong>not</strong> be included in the request.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<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="evenRow">
<td align="center">name</td>
<td>
<p>Module-relative name (starting with a '/') of the web application
resource to be dispatched, and whose response data is to be made
available as a bean.</p>
<p class="deprecated">
<strong>DEPRECATED:</strong>
Use the "page" attribute instead.
</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">page</td>
<td>
<p>Module-relative URI (starting with a '/') of the web application
resource to be included.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">transaction</td>
<td>
<p>Set to <code>true</code> if you want the current
transaction control token included in the generated
URL for this include.</p>
[RT Expr]
</td>
</tr>
</table>
</div>
<p>
<a href="#top">Back to top</a>
</p>
<h3 id="message">
<strong>message</strong> -
Render an internationalized message string to the response.
</h3>
<div class="indent">
<p>Retrieves an internationalized message for the specified locale,
using the specified message key, and write it to the output stream.
Up to five parametric replacements (such as "{0}") may be specified.</p>
<p>The message key may be specified directly, using the <code>key</code>
attribute, or indirectly, using the <code>name</code> and
<code>property</code> attributes to obtain it from a bean.</p>
<p>
<strong>JSTL</strong>: The equivalent JSTL tag is <fmt:message>. For example,
<br />
<code>
<fmt:message key="my.msg.key">
<fmt:param value="replacement text"/>
</fmt:message>
</code>
</p>
<table class="tag-attributes">
<thead>
<tr>
<th class="attribute">Attribute Name</th>
<th>Description</th>
</tr>
</thead>
<tr class="evenRow">
<td align="center">arg0</td>
<td>
<p>First parametric replacement value, if any.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">arg1</td>
<td>
<p>Second parametric replacement value, if any.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">arg2</td>
<td>
<p>Third parametric replacement value, if any.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<td align="center">arg3</td>
<td>
<p>Fourth parametric replacement value, if any.</p>
[RT Expr]
</td>
</tr>
<tr class="evenRow">
<td align="center">arg4</td>
<td>
<p>Fifth parametric replacement value, if any.</p>
[RT Expr]
</td>
</tr>
<tr class="oddRow">
<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="evenRow">
<td align="center">key</td>
<td>
<p>The message key of the requested message, which must have
a corresponding value in the message resources. If not specified,
the key is obtained from the <code>name</code> and
<code>property</code> attributes.</p>
[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 used as the message resource key.</p>
[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 value
of the bean identified by <code>name</code> will itself be used as the
message resource key.</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>
<h3 id="page">
<strong>page</strong> -
Expose a specified item from the page context as a bean.
</h3>
<div class="indent">
<p>Retrieve the value of the specified item from the page context
for this page, and define it as a scripting variable, and a page scope
attribute accessible to the remainder of the current page.</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 page context property.</p>
[Required]
</td>
</tr>
<tr class="oddRow">
<td align="center">property</td>
<td>
<p>Name of the property from our page context to be retrieved and
exposed. Must be one of <code>application</code>, <code>config</code>,
<code>request</code>, <code>response</code>, or <code>session</code>.
</p>
[Required]
[RT Expr]
</td>
</tr>
</table>
</div>
<p>
<a href="#top">Back to top</a>
</p>
<h3 id="parameter">
<strong>parameter</strong> -
Define a scripting variable based on the value(s) of the specified
request parameter.
</h3>
<div class="indent">
<p>Retrieve the value of the specified request parameter (as a single
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -