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>
You must create or locate a Bean instance with <jsp:useBean>
before you use <jsp:getProperty>
.
The <jsp:getProperty>
tag gets a Bean property value using the property's get
method, converts the value of a Bean property to a String
and stores it in the out
object.
In JSP 1.0, <jsp:getProperty>
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. You can get around this limitation by writing a JSP application in which a JSP file gets values from a Bean, and the Bean in turns calls an enterprise bean.
name="
beanInstanceName"
The name of the Bean instance as declared in a <jsp:useBean>
tag.
property="
propertyName"
The name of the Bean property whose value you want to display.