java.lang.IllegalStateException:Optional int parameter ' Currentspecialindex ' is present but cannot

Source: Internet
Author: User
java.lang.IllegalStateException:Optional int parameter ' Currentspecialindex ' is present but cannot to be translated into a n Ull value due to being declared as a primitive type. Consider declaring it as Object wrapper for the corresponding primitive type.

Spring MVC encapsulation Parameter conjecture
1. If you use an object to accept a parameter spring, you first come out of the new object and assign the returned values to the attribute.
2. If you write a variable directly in the method to accept the foreground parameter if it matches to the variable then the assignment if the foreground does not have a corresponding variable, spring gives the variable a null value instead of the default value for the change amount type.
Public Knowledge findvideobyspecialid (int specialid,int currentpage)
The problem is that I've defined an int type of variable to accept the parameter passing in, but the foreground doesn't pass in the parameter so sping gives a null but NULL does not assign a value to int so throwing an exception can consider using string types or encapsulating parameters as objects or wrapping types of that type.

-Waiting to be verified ....

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.