Optional int parameter 'fundID' is present but cannot be translated into a null value due to being declared as a primitive type
错误的意思是: "可选的int参数'fundID'存在但由于被声明为基本类型而无法转换为空值"
意思是fundID被申明为int的基本数据类型, 不能转换为字符串的null值. 难道是在参数调用
的时候, 需要把fundID设置为对象类型吗? 答案是正确的.
@RequestMapping(value = "/fund-purchase")
public String fundPurchase(int fundID) {
Fund fund = fundService.selectFundByID(1);
System.out.println("fund: " + fund);
return null;
}
解决办法: int 改为 Integer,
前端通过url传递过来的数据, 改为对象类型
@RequestMapping(value = "/fund-purchase")
public String fundPurchase(Integer fundID) {
Fund fund = fundService.selectFundByID(1);
System.out.println("fund: " + fund);
return null;
}
问题解决!
Optional int parameter 'fundID' is present but cannot be translated into a null value due to being declared as a primitive type的更多相关文章
- Optional int parameter 'pId' is present but cannot be translated into a null value due to being declared as a primitive type.
接口测试的时候遇到了一个问题,导致测试阻断了好久,在此记录,谨防忘记. 具体报错如下: Optional int parameter 'pId' is present but cannot be tr ...
- is present but cannot be translated into a null value due to being declared as a primitive type
解决办法:把基本类型改为对象,譬如此处将pageId的类型由int 改为Integer 2016-10-19 19:36:11.275 DEBUG [http-nio-9999-exec-2][org ...
- Optional int parameter 'time' is present but cannot be translated into a null value due to being decla
今天在操作redis的时候报了这个错:Optional int parameter 'time' is present but cannot be translated into a null val ...
- Optional int parameter 'rows' is not present but cannot be translated into a null value due to being declared as a primitive type.
我的spring mvc 代码: @Controller @RequestMapping("/product") public class Fancy { @RequestMapp ...
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
这个错误可以将参数由int改为Integer
- Optional int parameter 'resourceState' is present but cannot be translated into a null value
错误日志: java.lang.IllegalStateException: Optional int parameter 'resourceState' is present but cannot ...
- Tomcat上java.lang.IllegalStateException: Optional int parameter 'id' is not present
今日, 本人在tomcat+spring mvc平台的服务器上遇到java.lang.IllegalStateException: Optional int parameter 'id' is not ...
- Required String parameter ' ' is not present
Required String parameter ' ' is not present 报错原因: url中的参数错误. 解决方法: 1.修正url中的参数的值. 2.在Controller层中的@ ...
- 使用springmvc报错Required int parameter 'age' is not present
仔细检查jsp代码 <a href="springmvc/testRequestParam?username=atguigu$age=11">Test RequestP ...
随机推荐
- 在pom包中添加spring-boot-starter-test包引用
有很多网友会时不时的问我,spring boot项目如何测试,如何部署,在生产中有什么好的部署方案吗?这篇文章就来介绍一下spring boot 如何开发.调试.打包到最后的投产上线. 开发阶段 单元 ...
- ajax异步请求问题
今天在使用异步请求删除图片时,想在页面测试是不是有效果,使用halt完全没反应,我以为是AJAX请求地址有问题,没有请求到这个方法中,但是在控制台中network的请求地址是正常的,后来反应过来了,异 ...
- FileTest
package com.yd.wmsc.util; import java.io.File; public class FileTest { public static void main(Strin ...
- springBoot使用外部Tomcat启动项目
实现思路是: 将springBoot项目自带的tomcat在部署的时候不使用. 方法一:将springBoot自带tomcat编辑成只在编译和测试时使用. 转载出处:https://www.edurt ...
- python模块之datetime方法详细介绍
datetime Python提供了许多内置模块用于操作时间日期,如calendar,time,datetime,这篇文章主要是对datetime进行汇总,datetime模块的借口实现原则更加直观, ...
- 在CMD下运用管理员权限
方法一:鼠标右键 这个方法比较比较普通,点开开始找到cmd,右击鼠标“以管理员身份运行(A)”这样调用就是管理员的权限: 方法二:快捷模式 在点开win+R后,选择“以管理员身份运行”,然后确定:可以 ...
- tcpdump安装配置及抓包分析
http://blog.csdn.net/e421083458/article/details/23963189 cpdump安装配置及抓包分析 预装软件:[plain] view plain cop ...
- 关于vi 分屏的一些指令
分屏都是以ctrl + W(大写) 首先,ctrl+ W , v 为切屏 之后用 :e 打开其他文件 ctrl + W , c 为关闭当前分屏 ctrl + W , h 为切换到左侧分屏 ...
- Windows进程通信之一看就懂的匿名管道通信
目录 进程通信之一看就懂的匿名管道通信 一丶匿名管道 1.1何为匿名管道 1.2创建匿名管道需要注意的事项 1.3 创建匿名管道需要的步骤 1.4代码例子 1.5代码运行截图 进程通信之一看就懂的匿名 ...
- xcrun -sdk 选择
在将FFmpeg编译成IOS版的时候,接触到编译脚本的一段(删减了部分): for ARCH in $ARCHS do if [ "$ARCH" = "i386" ...