zoukankan      html  css  js  c++  java
  • ModelAndView的部分回顾

                              ModelAndView的部分回顾

    //@RestController @Controller //@SessionAttributes("user") //把modelandview中user attribute对象 拷贝了一份到session的共享控制当中。 public class Test01Controller { // path 和value一样 但是produces = "text/html;charset=utf-8"不能变 @RequestMapping(path = "/mv/{path}.do",produces = "text/html;charset=utf-8") public ModelAndView test(@PathVariable("path") String path){ System.out.println(path); ModelAndView mv = new ModelAndView(); Map map = new HashMap(); map.put("username","admin"); map.put("password","123456"); //一次性添加多个attribute对象 mv.addAllObjects(map); //attribute对象 request mv.addObject("user","username"); //你要跳转到那里 服务器跳转 //也可客户端跳转但是值就不能传递了 mv.setViewName("/success.jsp"); return mv; } @RequestMapping("/m.do") public String test01(@SessionAttribute("user")String user, Integer [] ids){ System.out.println("user:"+user); return "success.jsp"; } @RequestMapping(value = "/lang.do") public String introinfo(HttpServletRequest request, Model model) { Locale locale = RequestContextUtils.getLocaleResolver(request).resolveLocale(request); System.out.println(locale.getLanguage()); //DynamicDataSource.setCurrentLookupKey(locale.getLanguage()); return "success.jsp"; } }
  • 相关阅读:
    1.文件I/O
    sqlite-按日期分组,根据日期查询详细内容
    sqlite-在数据库中创建默认时间
    Git-git 忽略 IntelliJ .idea文件
    重启猫(modem)的方法
    从TP、FP、TN、FN到ROC曲线、miss rate、行人检测评估
    畅所欲言第1期
    使用属性表:VS2013上配置OpenCV
    关于OOM那些事儿
    深度学习之江湖~那些大神们
  • 原文地址:https://www.cnblogs.com/chaoesha/p/13069002.html
Copyright © 2011-2022 走看看