jsp:setProperty |

This standard action is used in conjunction with the useBean action described in the preceding section, and sets the value of simple and indexed properties in a bean.

The properties in a bean can be set either:

- at request time from parameters in the request object,
- at request time from an evaluated expression, or
- from a specified string (or hard coded in the page).

        <jsp:setProperty name=" beanName" propertydetails />

Where propertydetails is one of:

- property="*"
- property="propertyName"
- property="propertyName" param="parameterName"
- property="propertyName" value="propertyValue"

and propertyValue is a string or a scriptlet.

Example

        <jsp:useBean id="help" scope="request" class="projsp.SpellCheck" />
        <jsp:setProperty name="help" property="*"/>

name |
The name of a bean instance defined by a <jsp:useBean> tag.

property |

The name of the bean property whose value is being set.

If this is set to "*" then the tag iterates over all the parameters in the ServletRequest, matching parameter names and value types to bean properties, and 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 |

It is not necessary that the bean have the same property names as the names in the name-value pairs in the request.

This attribute is used to specify the name of the request parameter whose value you want to assign to a bean property. However if the param value is not specified, then the request parameter name is assumed to be the same as the bean property name.

If the parameter is not set in the ServletRequest, or has the value of "", the jsp:setProperty standard action has no effect on the bean.

value |
The value to assign to the bean property. This can be a string or a request-time expression. A tag cannot have both param and value attributes.