Java EL expression report null pointer exception (NULLPOINTEXCEPTION)

Source: Internet
Author: User

Recently in the use of El expression, the use of the int variable, because, many times, the variable will not be assigned to the initial value, after consideration, should be declared from int to Integer, after the change has been reported null pointer exception, after careful review, my getter and setter method, either set int or return int, which has been tested before, declares an integer variable, does not initialize, and returns a null pointer exception with an int. The reason should be an integer (null) to int times error. Therefore, the data of the El expression background must be at the same time the class or the same basic type, (the basic type of the number type, return is 0 or 0.0,char type of return null character, what is inside, no scrutiny, Boolean variable return false), if you need the foreground no initial value, You need to use the object type data (such as the bound input box to display no data, i.e. the data is null)

2018-05-04 Update

In fact, the El expression is called by the Get method to get the value.

Java EL expression report null pointer exception (NULLPOINTEXCEPTION)

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.