欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

SpringMVC的@InitBinder參數(shù)轉(zhuǎn)換代碼實(shí)例

 更新時(shí)間:2019年09月26日 10:53:41   作者:蔡徐坤1987  
這篇文章主要介紹了SpringMVC的@InitBinder參數(shù)轉(zhuǎn)換代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下

這篇文章主要介紹了SpringMVC的@InitBinder參數(shù)轉(zhuǎn)換代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下

@Controller
@RequestMapping("/index")
public class IndexController {
  /**
   * 解決前端傳遞的日期參數(shù)驗(yàn)證異常
   *
   * @param binder
   * @author hzj
   */
  @InitBinder({"param", "date"})//指定校驗(yàn)參數(shù)
  protected void initBinder(WebDataBinder binder) {
    // binder.setDisallowedFields("name"); // 不綁定name屬性
    binder.registerCustomEditor(String.class, new StringTrimmerEditor());
    // 此處使用Spring內(nèi)置的CustomDateEditor
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
  }
  @ResponseBody
  @GetMapping("/initbinder")
  public String testInitBinder(String param, Date date) {
    return param + ":" + date;
  }
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論