| |||||||
FRAMES NO FRAMES |
<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
<anyxmlelement xmlns:bean="http://struts.apache.org/tags-bean" />
Note: Some of the features in this taglib are also available in the JavaServer Pages Standard Tag Library (JSTL). The Struts team encourages the use of the standard tags over the Struts specific tags when possible.
This tag library contains tags useful in accessing beans and their properties, as well as defining new beans (based on these accesses) that are accessible to the remainder of the page via scripting variables and page scope attributes. Convenient mechanisms to create new beans based on the value of request cookies, headers, and parameters are also provided.
Many of the tags in this tag library will throw a
JspException
at runtime when they are utilized incorrectly (such as when you specify an invalid combination of tag attributes). JSP allows you to declare an "error page" in the<%@ page %>
directive. If you wish to process the actual exception that caused the problem, it is passed to the error page as a request attribute under keyorg.apache.struts.action.EXCEPTION
.
Tag Library Information | |
Display Name | None |
Version | 1.3 |
Short Name | bean |
URI | http://struts.apache.org/tags-bean |
Tag Summary | |
cookie | Define a scripting variable based on the value(s) of the specified request cookie. Retrieve the value of the specified request cookie (as a single value or multiple values, depending on the If no cookie with the specified name can be located, and no default value is specified, a request time exception will be thrown. |
define | Define a scripting variable based on the value(s) of the specified bean property. Create a new attribute (in the scope specified by the
If a problem occurs while retrieving the specified bean property, a request time exception will be thrown. The
USAGE NOTE - There is a restriction in the JSP 1.1 Specification that disallows using the same value for an USAGE NOTE - If you use another tag to create the body content (e.g. bean:write), that tag must return a non-empty String. An empty String equates to an empty body or a null String, and a new scripting variable cannot be defined as null. Your bean must return a non-empty String, or the define tag must be wrapped within a logic tag to test for an empty or null value. USAGE NOTE - You cannot use bean:define to instantiate a DynaActionForm (type="org.apache.struts.action.DynaActionForm") with the properties specified in the struts-config. The mechanics of creating the dyna-properties is complex and cannot be handled by a no-argument constructor. If you need to create an ActionForm this way, you must use a conventional ActionForm. See the Bean Developer's Guide section on bean creation for more information about these differences, as well as alternative approaches to introducing beans into a JSP page. |
header | Define a scripting variable based on the value(s) of the specified request header. Retrieve the value of the specified request header (as a single value or multiple values, depending on the If no header with the specified name can be located, and no default value is specified, a request time exception will be thrown. |
include | Load the response from a dynamic application request and make it available as a bean. 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 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):
|
message | Render an internationalized message string to the response. 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. The message key may be specified directly, using the JSTL: The equivalent JSTL tag is <fmt:message>. For example, |
page | Expose a specified item from the page context as a bean. 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. If a problem occurs while retrieving the specified configuration object, a request time exception will be thrown. |
parameter | Define a scripting variable based on the value(s) of the specified request parameter. Retrieve the value of the specified request parameter (as a single value or multiple values, depending on the If no request parameter with the specified name can be located, and no default value is specified, a request time exception will be thrown. |
resource | Load a web application resource and make it available as a bean. Retrieve the value of the specified web application resource, and make it available as either a If a problem occurs while retrieving the specified resource, a request time exception will be thrown. |
size | Define a bean containing the number of elements in a Collection or Map. Given a reference to an array, Collection or Map, creates a new bean, of type
|
struts | Expose a named Struts internal configuration object as a bean. 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 If a problem occurs while retrieving the specified configuration object, a request time exception will be thrown. |
write | Render the value of the specified bean property to the current JspWriter. Retrieve the value of the specified bean property, and render it to the current JspWriter as a String by the ways:
When a format string is provided, numeric values are formatted using the If a problem occurs while retrieving the specified bean property, a request time exception will be thrown. |
| |||||||
FRAMES NO FRAMES |