<Jsp: getProperty>
Obtains the Bean property value, which is displayed on the page.
JSP syntax
<Jsp: getProperty name = "beanInstanceName" property = "propertyName"/>
Example
<Jsp: useBean id = "calendar" scope = "page" class = "employee. Calendar"/>
<H2>
Calendar of <jsp: getProperty name = "calendar" property = "username"/>
</H2>
Description
The <jsp: getProperty> element obtains the Bean property value and can be used or displayed on the JSP page. before using <jsp: getProperty>, you must use <jsp: useBean> to create it.
<Jsp: getProperty> elements have some restrictions:
You cannot use <jsp: getProperty> to retrieve an indexed property.
You can use <jsp: getProperty> with the JavaBeans component, but not with the Enterprise
Bean.
Attribute
Name = "beanInstanceName"
Bean name, specified by <jsp: useBean>
Property = "propertyName"
Attribute name of the specified Bean.
TIPS:
As mentioned in sun's JSP reference, if you use <jsp: getProperty> to retrieve a value that is null, NullPointerException will occur. If you use a program segment or expression to retrieve the value, in the browser, null is displayed ).