Optional int parameter 'version' is present but cannot be translated into a null value due to being
来源:互联网 发布:java继承和多态实例 编辑:程序博客网 时间:2024/05/19 09:02
这种情况一般是这种情景下造成的:首次加载这个方法时,是没有参数的值带进来的,后面再进入该方法的时候参数就有值带进来了,String类型的没什么问题,但是int类型就有问题了,因为参数如果没有值的情况下是默认赋null,int类型的参数肯定不能定义null所以导致报错了;
解决办法:
方法一:定义成Integer类型,Integer version;
方法二:给参数设置默认值,@RequestParam(defaultValue = "0")int version
1 0
- Optional int parameter 'version' is present but cannot be translated into a null value due to being
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'page' is present but cannot be translated into a null value due to being dec
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'rip' is present but cannot be translated into a null value due to being decl
- Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'folderId' is not present but cannot be translated into a null value due to b
- Optional int parameter 'pageNumber' is present but cannot be translated into a null value due to bei
- java.lang.IllegalStateException: Optional int parameter 'pageSize' is present but cannot be translat
- java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot
- float和Float的问题,错误原因:cannot be translated into a null value
- linq insert The null value cannot be assigned to a member with type System.Int64 which is a non-null
- 报错: LINQ to Entities does not recognize the method...and this method cannot be translated into a sto
- ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated ORA-01264: Unable to
- Dereferencing a __weak pointer is not allowed due to possible null value caused by race condition, a
- Warning: Variable 'a' cannot be saved to a MAT-file whose version is older than 7.3.
- Warning: Variable 'a' cannot be saved to a MAT-file whose version is older than 7.3.
- C#代码发送get/post请求的方法
- 页面与后台传递中文乱码问题(java乱码)
- 设置导航栏前景颜色
- C#控制台基础 用for循环遍历arraylist集合
- Java----异常类(错误和异常,两者区别)
- Optional int parameter 'version' is present but cannot be translated into a null value due to being
- Hi3516A开发--内存换算
- dedecms cookies泄漏导致SQL漏洞 article_add.php 的解决方法
- Linux 中最佳的壓縮格式:為什麼 bzip2 會被 xz 取代?那 gzip 又如何?
- Spring scope详解
- 394. Decode String
- ajax返回值中有回车换行、空格的解决方法分享
- VijosP1200ganggang的烦恼
- linux服务器带宽测试