Contents | Prev | Next


<jsp:getProperty>

Inserts the value of a bean property into the result.

JSP Syntax

<jsp:getProperty name="beanInstanceName" property="propertyName" />

XML Syntax

<jsp:getProperty name="beanInstanceName" property="propertyName" />

Examples

<jsp:useBean id="calendar" scope="page" class="employee.Calendar" />	
<h2>	
Calendar of <jsp:getProperty name="calendar" property="username" />	
</h2>

Description

The <jsp:getProperty> element gets a bean property value using the property's getter methods and inserts the value into the response. You must create or locate a bean with <jsp:useBean> before you use <jsp:getProperty>.

The <jsp:getProperty> element has a few limitations you should be aware of:

Attributes

Tip

If you use <jsp:getProperty> to retrieve a property value that is null, a NullPointerException is thrown. However, if you use a scriptlet or expression to retrieve the value, the string null is displayed in the browser; see Scriptlet or Expression for more information.

See Also



Contents | Prev | Next

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