JSP syntax (9)--

Source: Internet
Author: User
js| Grammar <jsp:getProperty>


Gets the value of the Bean's property for display in the page





JSP syntax



<jsp:getproperty name= "Beaninstancename" property= "PropertyName"/>


Example




<jsp:usebean id= "Calendar" scope= "page" "class=" employee. Calendar "/>


Calendar of <jsp:getproperty name= "Calendar" property= "username"/>







Describe


This <jsp:getProperty> element will get the Bean's property value and can be used or displayed in the JSP page. Before you use <jsp:getProperty>, you must use <jsp:useBean> Create it.


<jsp:getProperty> elements have some limitations:




You can't use <jsp:getProperty> to retrieve a property that has already been indexed.


You can use &LT;JSP:GETPROPERTY&GT with JavaBeans components, but not with enterprise

Bean used together.





Property





Name= "Beaninstancename"
Name of the bean, specified by <jsp:useBean>





Property= "PropertyName"
The name of the property of the specified bean.





Skills:




As mentioned in Sun's JSP reference, if you use <jsp:getProperty> to retrieve a value that is null, then NullPointerException will appear, and if you use a program segment or an expression to retrieve its value, Then there is null (empty) on the browser.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.