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 ...
随机推荐
- Orthanc+OHIF DICOM Viewer最佳Dicom解析、在线浏览实践指南(解决方案)
概念 DICOM identifiers Very importantly, the DICOM standard specifies DICOM tags that allow to index e ...
- Java基础笔记(十二)——方法
方法:实现一个功能. 方法声明: 访问修饰符 返回类型 方法名(参数列表){ //方法体 } 访问修饰符:public.private.protect.default 返回类型:void——无返 ...
- jmeter如何设置全局变量以及调用方法
当遇到如跨线程组调用变量等情况,需要设置全局变量. 1.打开函数助手 输入需要的值然后点击生成按钮,或者直接使用${__setProperty(newuserid,${userid},)}的格式 设置 ...
- QT的学习
背景 最近正忙着做一个项目,由于之前对面向对象编程了解的非常少,所以导致项目的代码有很多不太清楚:看到代码的时候整个人是懵的.所以在国庆期间,结合着大神的博客看了一下面向对象编程,并学习了开发GUI应 ...
- codeforces C. Vasya And The Mushrooms (思维+模拟)
题意:给定一个2*n的矩形方格,每个格子有一个权值,从(0,0)开始出发,要求遍历完整个网格(不能重复走一个格子),求最大权值和,(权值和是按照step*w累加,step步数从0开始). 转载: 题解 ...
- 华东交通大学2017年ACM“双基”程序设计竞赛 1005
Problem Description 假设你有一个矩阵,有这样的运算A^(n+1) = A^(n)*A (*代表矩阵乘法)现在已知一个n*n矩阵A,S = A+A^2+A^3+...+A^k,输出S ...
- 一步一步在Windows中使用MyCat负载均衡
一步一步在Windows中使用MyCat负载均衡 http://www.cnblogs.com/zhangs1986/p/6408981.html mycat+sqlServer简单demo配置 ...
- 记录一个调试REST风格的web服务的client
coogle浏览器的advanced rest client很好用,记录一下,脑子不好,容易忘,,可以在chrome 的网上应用店添加 Rest client是用来调试REST风格的Web服务,接收P ...
- c++概念字符串操作 (转)
本文转自:http://www.jb51.net/article/37410.htm 一.char_traits 字符特征类 1)意义:包装特定串元素的通用行为界面,以便容器实现时依据特征信息而执行特 ...
- 【Java密码学】用Java数字签名提供XML安全
简介 众所周知,XML在产品和项目开发中起着非常重要的作用.通过XML文档可以获取很多信息,还可以使用XML文件进行CRUD(增加.查询.更新和删除)操作.然而值得注意的是,我们如何确保XML中的数据 ...