MDA/MDD/TDD/DDD/DDDDDDD
          posts - 536, comments - 111, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          spring mvc筆記

          Posted on 2009-01-08 09:31 leekiang 閱讀(312) 評論(0)  編輯  收藏 所屬分類: spring
          1,<spring:bind>是spring2.0以前的寫法。
          2,public ModelAndView login(HttpServletRequest request,
          ?? ??? ??? ?HttpServletResponse response,HttpSession session,User user)
          ? public ModelAndView login(HttpServletRequest request,
          ?? ??? ??? ?HttpServletResponse response,User user)
          MultiActionController自動把最后一個參數當作Command對象。
          也可以覆蓋protected Object newCommandObject(Class clazz)方法,但這樣每個 Controller的Command對象就是同一個iele,
          同時要改為
          public ModelAndView login(HttpServletRequest request,
          ?? ??? ??? ?HttpServletResponse response,Object command)再對command造型
          ?? ??? ??? ?
          3,重定向寫法
          return new ModelAndView("redirect:/system/user.do?do=addUserForm");

          4,有2個JsonView的,或者更適合Ajax,當然自己寫一個JsonView都很簡單
          1) json-lib-ext-spring
          http://sourceforge.net/projects/json-lib/files/
          2) spring json view
          http://spring-json.sourceforge.net/download.html
          http://article.yeeyan.org/view/jdonee/10145

          5, 綁定的基本寫法
          ServletRequestDataBinder binder = new ServletRequestDataBinder(obj);
          ??? ??? SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
          ??? ??? binder.registerCustomEditor(Date.class, new CustomDateEditor(
          ??? ??? ??? ??? dateFormat, true));
          ??? ??? binder.setDisallowedFields(new String[]{"endtime"});
          ??? ??? binder.bind(request);
          主站蜘蛛池模板: 邹平县| 墨脱县| 长垣县| 弥勒县| 海南省| 宁南县| 镶黄旗| 甘洛县| 长阳| 会昌县| 河南省| 天全县| 榆林市| 永寿县| 呼图壁县| 保德县| 冀州市| 久治县| 涞水县| 包头市| 托里县| 左贡县| 金堂县| 梁河县| 商丘市| 瓦房店市| 平安县| 临邑县| 鄂尔多斯市| 盐山县| 阳春市| 恭城| 嘉禾县| 中卫市| 卓资县| 天长市| 万载县| 茌平县| 临朐县| 济南市| 马鞍山市|