琐碎总结(SpringMvc)

来源:互联网 发布:mac的图片处理 编辑:程序博客网 时间:2024/06/04 23:27

request.getSession(true):若存在会话则返回该会话,否则新建一个会话。等同于request.getSession()
request.getSession(false):若存在会话则返回该会话,否则返回NULL

 

http://jinnianshilongnian.iteye.com/blog/1617451   跟开涛学SpringMvc

 

http://www.chedong.com/tech/cache_docs.html  HTTP缓存控制及为什么要缓存

 

 

 

 

AbstractCommandController

  1. package cn.javass.chapter4.model;  
  2. public class UserModel {  
  3.     private String username;  
  4.     private String password;  
  5.         //省略setter/getter  
  6. }  
  1. package cn.javass.chapter4.web.controller;  
  2. //省略import  
  3. public class MyAbstractCommandController extends AbstractCommandController {  
  4.     public MyAbstractCommandController() {  
  5.         //设置命令对象实现类  
  6.         setCommandClass(UserModel.class);  
  7.     }  
  8.     @Override  
  9.     protected ModelAndView handle(HttpServletRequest req, HttpServletResponse resp, Object command, BindException errors) throws Exception {  
  10.         //将命令对象转换为实际类型  
  11.         UserModel user = (UserModel) command;  
  12.         ModelAndView mv = new ModelAndView();  
  13.         mv.setViewName("abstractCommand");  
  14.         mv.addObject("user", user);  
  15.         return mv;  
  16.     }  
  17. }   

 

原创粉丝点击