springmvc 數據綁定 validate

springmvc數據綁定,作驗證時,方式應該以下寫:spring

public String add(@Valid User user,BindingResult binding),裏面要有處理驗證結果的BindResult若是沒有加,像以下這樣:mvc

 public String add(@Valid User user),則會報錯,報錯內容以下:spa

HTTP Status 400 -


type Status reportorm

messageip

description The request sent by the client was syntactically incorrect.it

相關文章
相關標籤/搜索