bean:write

 < Day Day Up > 



<bean:write />

The <bean:write /> tag is used to retrieve and print the value of a named bean property. If the format attribute is encountered, then the value being written will be formatted based upon the format string represented by the format attribute. The <bean:write /> tag has no body and supports nine attributes, described in Table 20.11.

Table 20.11: <bean:write /> Tag Attributes

Attribute

Description

bundle

Represents the condition to be evaluated by the <bean:if> tag. If the <bean:if> tag is being included from the expression language tag library, then the value represented by the test attribute must evaluate to a Boolean primitive or a java.lang.Boolean. If the <bean:if> tag is being included from the runtime tag library, then the value represented by the test attribute must evaluate to a java.lang.Boolean. (Required)

filter

If set to true, causes the retrieved value to be filtered for HTML reserved characters. If an HTML specific character is found, it will be replaced by its encoded counterpart. The default value of this attribute is false. (Optional)

format

Specifies the format string to use when converting the retrieved value to a String. (Optional)

formatKey

Specifies the key to search for a format string that is stored in an application resource bundle. (Optional)

ignore

If set to true and the named bean does not exist, causes the tag to skip its processing and ignore its evaluation. The default value is false, which causes a runtime exception to be thrown, consistent with the other tags in this tag library. (Optional)

locale

Identifies the session bean that references the current Locale object. The default value is Action.LOCALE_KEY. (Optional)

name

Identifies the attribute name of the bean property that is being retrieved and printed. If the property attribute is not included, then the value of the bean itself will be printed. (Optional)

property

Identifies the name of the bean property being accessed. (Optional)

scope

Identifies the scope of the bean specified by the name attribute. If the scope attribute is not specified, then the tag will search for the bean in the scopes, in the order of page, request, session, and application. (Optional)

An example of using the <bean:write /> tag is shown here:

 <bean:write name="employee"   property="username" /> 

In this example, we retrieve and print the username property of the employee scripting variable. Here, because the scope attribute is not set, the tag will search for the bean in the scopes, in the order of page, request, session, and application.



 < Day Day Up > 



Professional Jakarta Struts
Professional Jakarta Struts (Programmer to Programmer)
ISBN: 0764544373
EAN: 2147483647
Year: 2003
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net