您的位置:首页 > 编程语言 > Java开发

Spring提交表单报莫名其妙的400错误

2017-04-23 00:00 393 查看
关于Spring提交表单报莫名其妙的400错误:

HTTP Status 400 – Bad Request
Type Status Report
Description 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).

后台使用了ConversionService:
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

若表单输入的参数不符合java bean定义的格式就会报400:
eg:
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthday;

@NumberFormat(style = NumberFormat.Style.NUMBER, pattern = "#,###")
private int total;

@NumberFormat(style = NumberFormat.Style.PERCENT)
private double discount;

@NumberFormat(style = NumberFormat.Style.CURRENCY)
private double money;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Spring