原文链接:这里这里!

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相关推荐

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

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

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

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

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

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

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

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

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

最新文章

  1. C++ 把输出结果写入到文件中
  2. 为什么nodejs是单进程的_Nodejs·进程
  3. Lucene工具箱之OpenBitSet(一)
  4. python怎么定义全局字典_一种Python全局配置规范以及其魔改
  5. python界面编程和网口通信_Python—网络通信编程之tcp通信编程
  6. C语言和其他语言的不得不说的差别!
  7. 【css】响应式布局 @media媒介 适配平板手机
  8. Algs4-1.3.45栈的可生成性
  9. visio插入箭头_visio流程图中画箭头
  10. 假设检验 python_数据清洗、假设检验
  11. JSEclipse安装后无法打开js文件_火狐浏览器打开邮箱添加不了附件
  12. 无线条码仓库管理系统
  13. 周鸿祎:做到这五点,才算是好用户体验
  14. Tea Data Analysis System 茶饮数据分析系统
  15. bzoj2429: [HAOI2006]聪明的猴子(最小生成树)
  16. 一个屌丝程序员的青春(一一零)
  17. xxxxxxxxxxxxxx
  18. 程序员能有什么好的出路?
  19. 无人叉车市场现状与发展趋势分析|无人叉车专题(一)
  20. Java语言的优雅停机 - 第308篇

热门文章

  1. springboot+java+jsp网上超市水果蔬菜果蔬商城购物管理系统
  2. 移动H5首屏秒开优化方案
  3. 12|QEMU:支持RISC-V的QEMU如何构建?
  4. React学习day13--antd组件:Layout布局
  5. 你是不是腾讯竞争对手的帮凶?
  6. 关于电磁场中的E.B.D.H的理解
  7. 不可多得的干货!docker目录找不到lede
  8. 【OpenAI】MADDPG算法与Multiagent-Envs环境项目总结
  9. 多媒体文件格式之ASF
  10. Android 删除aar包中的jar包解决Duplicate class包冲突问题