Gets the value of a bean property so that you can display it in a result page.
<jsp:getProperty name="
beanInstanceName" property="
propertyName" />
<jsp:useBean id="calendar" scope="page" class="employee.Calendar" />
<h2>
Calendar of <jsp:getProperty name="calendar" property="username" />
</h2>
The <jsp:getProperty>
element gets
a bean property value using the property's getter methods and displays the property
value in a JSP page. 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:
<jsp:getProperty>
to retrieve the values of an indexed property.
<jsp:getProperty>
with JavaBeans components, but not with enterprise beans. As alternatives, you can write a JSP page that retrieves values from a bean that in turn retrieves values from an enterprise bean, or you can write a custom tag that retrieves values from an enterprise bean directly.
name="
beanInstanceName"
<jsp:useBean>
element.
property="
propertyName"
<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.