Optional long parameter ‘beginDateLong’ is present but cannot be translated into a null value due to
原文链接:这里这里!
0.过程
使用SSM框架是controller层接收参数,前台传入时间戳,controller层接收的参数报错。
我当时的写法如下:
@ResponseBody
@RequestMapping(value = “/getdata”, method = RequestMethod.GET)
public JSONArray getdata(@Param(value = “beginTime”) long beginTime,
@Param(value = “endTime”) long endTime)
前台的请求是这样的结构:
http://localhost:4200/energyreport/energysumstruct/getdata?beginTime=1620950400000&endTime=1621468800000
然后就把代码的数据类型改了改,改成下面的这样
@ResponseBody
@RequestMapping(value = “/getdata”, method = RequestMethod.GET)
public JSONArray getdata(@Param(value = “beginTime”) long beginTime,
@Param(value = “endTime”) long endTime)
然后就正常了。
总结:
改用封装数据类型接收参数。如int就用Integer,long使用Long。
Optional long parameter ‘beginDateLong’ is present but cannot be translated into a null value due to相关推荐
- Optional int parameter ‘xxx‘ is present but cannot be translated into a null value due to being decl
错误描述: processing failed; nested exception is java.lang.IllegalStateException: Optional int parameter ...
- Optional int parameter 'page' is present but cannot be translated into a null value due to being dec
这个错误犯两回了 int改integer 原始类型不能为null 包装类可以 我的spring mvc 代码: @Controller @RequestMapping("/product&q ...
- Optional int parameter 'id' is present but cannot be translated into a null value due to being
执行## ........(int id);报出以下错误. Optional int parameter 'id' is present but cannot be translated into a ...
- Optional int parameter ‘page‘ is present but cannot be translated into a null value due to being dec
背景:在测试上面这个controller时(status为查询条件Limit,查询status为1/0的所有记录),当用postman发出请求http://localhost:8080/orders/ ...
- Optional int parameter ‘xxx‘ is present but cannot be translated into a null value due to being.....
异常代码 `j`ava.lang.IllegalStateException: Optional int parameter 'tyId' is present but cannot be trans ...
- Optional int parameter ‘xxx‘ is present but cannot be translated into a null value due to being
Optional int parameter 'domainId' is present but cannot be translated into a null value due to being ...
- Optional int parameter ‘grade‘ is present but cannot be translated into a null value due to being de
完整的错误提示信息: 复制出来看的清楚些: Optional int parameter 'grade' is present but cannot be translated into a null ...
- Optional int parameter ‘categoryId‘ is present but cannot be translated into a null value due to be
Optional int parameter 'categoryId' is present but cannot be translated into a null value due to bei ...
- Optional long parameter ‘PactId‘ is present but cannot be translated into a null value due to being
不能为null 值 将 long 接收 转成 Long Optional long parameter 'PactId' is present but cannot be translated int ...
最新文章
- C++ 把输出结果写入到文件中
- 为什么nodejs是单进程的_Nodejs·进程
- Lucene工具箱之OpenBitSet(一)
- python怎么定义全局字典_一种Python全局配置规范以及其魔改
- python界面编程和网口通信_Python—网络通信编程之tcp通信编程
- C语言和其他语言的不得不说的差别!
- 【css】响应式布局 @media媒介 适配平板手机
- Algs4-1.3.45栈的可生成性
- visio插入箭头_visio流程图中画箭头
- 假设检验 python_数据清洗、假设检验
- JSEclipse安装后无法打开js文件_火狐浏览器打开邮箱添加不了附件
- 无线条码仓库管理系统
- 周鸿祎:做到这五点,才算是好用户体验
- Tea Data Analysis System 茶饮数据分析系统
- bzoj2429: [HAOI2006]聪明的猴子(最小生成树)
- 一个屌丝程序员的青春(一一零)
- xxxxxxxxxxxxxx
- 程序员能有什么好的出路?
- 无人叉车市场现状与发展趋势分析|无人叉车专题(一)
- Java语言的优雅停机 - 第308篇