zoukankan      html  css  js  c++  java
  • 对于springmvc 很奇妙的报404错误的记录

    @RequestMapping("/editItems")
        public ModelAndView editItems(Integer id) throws Exception {
    @RequestMapping("/editItemsSubmit")
        public String editItemsSubmit(Integer id, ItemsCustom itemsCustom)throws Exception {

      上述两段代码,其中/editItems.action 服务器正常访问。 但/editItemsSubmit.action 报404错误。

      检查了半天路径,但是也没发现有什么错误。

      就又写了一个/test.action作为对比用:

    @RequestMapping("/test")
        public String test() throws Exception {

      结果也是正常访问。

      于是把错误定位在了参数 itemsCustom上。itemsCustom是一个pojo对象,其中有一个Date类型的属性,发现jsp输入的字符串并未经过转换器转换成Date类型,故不能对应到itemsCustom这个对象上,因此报出404错误。

      解决办法:写一个converter把字符串型的日期转换成Date类型(java.sql.Date还是java.util.Date取决于pojo中定义的Date所属的类)

           或干脆把jsp中日期的输入先屏蔽。。

      最近一直在报404错误,有时候重启一下eclipse就好了。。发现404真的很奇妙。。

  • 相关阅读:
    linux挂载ntfs格式的U盘
    linux tar命令
    chown chmod chgrp chattr chroot usermod 命令简单分析
    UI/UE/ID/UED/UCD的区别(转)
    搭建 Docker Swarm 集群
    端口
    linux crontab 定时任务
    centos8 安装 docker
    history 用法大全
    PHP生成正则表达式的类
  • 原文地址:https://www.cnblogs.com/kkkkkk/p/5493108.html
Copyright © 2011-2022 走看看