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"; } }
  • 相关阅读:
    java中的数组与集合的排序摘抄自:http://blog.csdn.net/jonathan_q_bo/archive/2005/11/29/539043.aspx
    JSF开发
    二维数组排序
    java properties
    HashMap按key排序
    Properties 类的使用
    鸟哥linux的简单sh程序设计http://blog.chinaunix.net/u/22249/showart.php?id=149846
    JSF中文教程
    JSF技术介绍
    关于Apache不能解析html内容
  • 原文地址:https://www.cnblogs.com/chaoesha/p/13069002.html
Copyright © 2011-2022 走看看