Spring的日常总结

111 阅读1分钟

Spring的日常总结

1.Cookie的用法

Cookie cookie=new Cookie(“username”,xxx);
//xxx可以使null
cookie.setMaxAge(24*7*60*60);
//括号里可以是0
responser.addCookie(cookie);

2.请求转发和重定向在Spring中的用法

//重定向写法
return:"redirect:/index/toIndex";(一般后面还要请求转发)
//请求转发写法
return “index”;

3.spring后端套路

Controller-->Service接口-->service实现类-->dao接口-->dao.xml(Mybatis框架)

4.常用注释

@Controller  常写在控制器上方
@RequestMapping  映射地址
@ResponseBody(不直接跳转到jsp,而是返回字符串,多用于ajax)
@Resource 资源注入
@Service  常写在Service实现类上方

5.回顾登录和注册流程

  1. 注册流程 注册流程.jpg

  2. 登录流程 登录流程.jpg

6.tomcat500该怎么找问题

答:找Cause!!!