LawrenceSin 2017-11-14 07:46 采纳率: 0%
浏览 4683
已结题

springMVC注解的时间注解不起作用

如题 配置@DateTimeFormat和 也有了joda-time

但注解@DateTimeFormat就是不起作用,一直报404
把这个注解去了 就没事,但时间格式就有问题了
The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). 上面是报的错误

  • 写回答

2条回答 默认 最新

  • like_a_cat 2017-11-14 08:26
    关注

    使用注解.在需要转换的参数或实体类属性上添加@DateTimeFormatter(pattern=”表达式”)
    2.1 使用Date参数接收
    @RequestMapping("demo")
    public String demo(@DateTimeFormat(pattern="yyyy-MM-dd") Date time){
    System.out.println(time);
    return "abc.jsp";
    }

    评论

报告相同问题?