错误的意思是: "可选的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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. Optional int parameter 'id' is present but cannot be translated into a null value due to being decla

    这个错误可以将参数由int改为Integer

  6. 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 ...

  7. Tomcat上java.lang.IllegalStateException: Optional int parameter 'id' is not present

    今日, 本人在tomcat+spring mvc平台的服务器上遇到java.lang.IllegalStateException: Optional int parameter 'id' is not ...

  8. Required String parameter ' ' is not present

    Required String parameter ' ' is not present 报错原因: url中的参数错误. 解决方法: 1.修正url中的参数的值. 2.在Controller层中的@ ...

  9. 使用springmvc报错Required int parameter 'age' is not present

    仔细检查jsp代码 <a href="springmvc/testRequestParam?username=atguigu$age=11">Test RequestP ...

随机推荐

  1. [转] 出现( linker command failed with exit code 1)错误总结

    这种问题,通常出现在添加第三方库文件或者多人开发时. 这种问题一般是找不到文件而导致的链接错误. 我们可以从如下几个方面着手排查. 1.以如下错误为例,如果是多人开发,你同步完成后发现出现如下的错误. ...

  2. jenkins 12

    在“参数化构建过程”中选择“List Subversion tags(and more)”,填写相应业务svn的url:这里在对应项目的svn(如下面的svn://192.168.9.120/fang ...

  3. windows驱动环境配置vs2010+wdk7600

    安装wdk后  要勾选集成VSIX选项到vs里面,不然vs里面新建项目时候找不到windows Driver 最简单的方式是安装wdk7600+vs2010+VisualDDK-1.5.7 这三个软件 ...

  4. [題解](迭代加深)POJ2248_Addition Chains

    發現m不會特別大,也就是層數比較淺,所以採用迭代加深 由於xi+xj可能相同,所以開一下vis數組判斷重複 #include<iostream> #include<cstdio> ...

  5. BZOJ 4260 Codechef REBXOR 01trie

    好题...开阔思路 把每个前缀异或和依次插入$01trie$,插之前找一个最优的(就是从高位向低位贪心,尽量走相反方向)看看能不能更新答案,此时相当于找到了区间右端点不超过某个点$r$的最大或和$f[ ...

  6. 03-----body标签中的相关标签

    今日主要内容: 列表标签 <ul>.<ol>.<dl> 表格标签 <table> 表单标签 <form> 一.列表标签 1.无序列表< ...

  7. 10g duplicate and 11g dupliacte db for standby

    ###################10g Creating a Physical Standby Database OASSTBY Make sure database is in archive ...

  8. spring MVC之注解开发控制器(二)

    开发表单控制器 在传统的Spring MVC开发方法中,是通过扩展SimpleFormController类来创建简单的表单控制器.这样就定义了基本的表单处理流程,并允许通过覆盖几个生命周期方法来定制 ...

  9. Xpath定位绝密版本

    xpath的作用就是两个字“定位”, 运用各种方法进行快速准确的定位,推荐两个非常有用的的firefox工具:firebug和xpath checker 在 XPath 中, 有七种类型的节点:元素. ...

  10. KindEditor编辑器使用

    KindEditor使用 1)kindeditor默认模式调用 <link rel="stylesheet" href="./KindEditor/themes/d ...