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<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 EnterpriseBean.
Attribute
TIPS:
- As mentioned in Sun's JSP reference, if you use <JSP: getproperty> to retrieve a null value
Nullpointerexception will occur.ProgramSegment or expression to retrieve its value, then null (null) appears in the browser ).