摘要:一、拦截机制 1、Struts2 a、Struts2框架是类级别的拦截,每次请求就会创建一个Action,和Spring整合时Struts2的ActionBean注入作用域是原型模式prototype(否则会出现线程并发问题),然后通过setter,getter把request数据注入到属性。b、S
阅读全文
摘要:SpringMVC数据绑定方式: 1. 基本数据类型(以int为例,其他类似):Controller代码: 1 @RequestMapping("saysth.do") 2 public void test(int count) { 3 } 表单代码: 1 <form action="saysth.
阅读全文
摘要:URL设计规范:/模块/资源/{标示}/集合1/... eg: /user/{uid}/friends ->好友列表 例子:秒杀系统API设计 1.请求参数绑定:@PathVariable("参数名"),也就是会传递到{}中 2.请求方式限制:method = RequestMethod.GET/P
阅读全文
摘要:首先创建一个maven项目,然后依次完成如下配置: 在pom.xml加入如下基础配置,利用maven加载我们所需要的jar: 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/
阅读全文