亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

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

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

@Controller
@RequestMapping("/index")
public class IndexController {
  /**
   * 解決前端傳遞的日期參數(shù)驗證異常
   *
   * @param binder
   * @author hzj
   */
  @InitBinder({"param", "date"})//指定校驗參數(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)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論