[Top] [Prev] [Next] [Bottom]

<jsp:setProperty>

Sets a property value or values in a Bean.

JSP Syntax

<jsp:setProperty 
		name="beanInstanceName"  
	{	property= "*" | 
		property="propertyName" [ param="parameterName" ] |
		property="propertyName" value="{ string | <%= expression %> }" 
	} 
/>

Examples

<jsp:setProperty name="mybean" property="*" />
<jsp:setProperty name="mybean" property="username" />
<jsp:setProperty name="mybean" property="username" value="Steve" />

Description

The <jsp:setProperty> tag sets the value of one or more properties in a JavaBean component, using the Bean's set methods. You must use a <jsp:useBean> tag to declare the Bean before you use <jsp:setProperty>. The value of name in <jsp:setProperty> must match the value of id in <jsp:useBean>.

With <jsp:setProperty>, you can set property values in several ways:

Each method of setting property values has its own syntax, as described in the next section.

Attributes and Usage

See Also



[Top] [Prev] [Next] [Bottom]

Copyright © 1999, Sun Microsystems, Inc. All rights reserved.