The <
jsp:setProperty>
 element has the following attributes:
name
The name of a Bean instance defined by a 
 element or 
some other element. The Bean instance must contain the property you 
want to set. The defining
element (in JSP 1.1 only a 
element) must appear before the 
 element in the 
same file.
property
The name of the Bean property whose value you want to set
If you set 
propertyName
 to 
*
 then the tag will iterate over the 
current 
ServletRequest
 parameters, matching parameter names 
and value type(s) to property names and setter method type(s), setting 
each matched property to the value of the matching parameter. If a 
parameter has a value of   , the corresponding property is not 
modified.
param
The name of the request parameter whose value you want to give to a 
Bean property. The name of the request parameter usually comes from a 
Web form
If you omit 
param
, the request parameter name is assumed to be the 
same as the Bean property name
If the param is not set in the Request object, or if it has the value of   , 
the 
jsp:setProperty
 element has no effect (a noop).
An action may not have both 
param
 and 
value
 attributes.
value
The value to assign to the given property.
This attribute can accept a request time attribute expression as a value.
An action may not have both 
param
 and 
value
 attributes.
2.13.3
An 
 action places the value of a Bean instance property, converted to 
a 
String
, into the implicit 
out
 object, from which you can display the value as output. The 
Bean instance must be defined as indicated in the 
name
 attribute before this point in the page 
(usually via a 
useBean
 action).
The conversion to String is done as in the println() methods, i.e. the 
toString()
 method 
of the object is used for Object instances, and the primitive types are converted directly.
If the object is not found, a request time exception is raised.
Chapter 2
Standard Syntax and Semantics
66




JSP Web Hosting JavaServer Pages Specifications JSP Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.