随笔分类 -  SpringMVC

摘要:@Controller@RequestMapping(value = "/test")public class TestController { @RequestMapping("/addUser") public void addUser(@ModelAttribute(value =... 阅读全文
posted @ 2014-05-20 19:38 无忧之路 阅读(358) 评论(0) 推荐(0) 编辑
摘要:@RequestMapping(value = "/getForm") @ResponseBody public List getForm(String pid) { return new ArrayList(){{ add("你好") }}; } 阅读全文
posted @ 2014-03-09 01:43 无忧之路 阅读(175) 评论(0) 推荐(0) 编辑
摘要:SpringMVC的controller是单例的,因此springMVC的controller不是线程安全的,在使用的时候要谨慎添加成员变量,因为所有的请求都会共享这个变量。与springMVC不同的是,struts2可以使用prototype来管理action,也就是说使用了prototype这种方式的话,action就是线程安全的了,action中的成员变量只提供给该请求。 阅读全文
posted @ 2013-12-27 21:28 无忧之路 阅读(691) 评论(0) 推荐(0) 编辑
摘要:一个servlet可以配置多个servlet-mapping,因此在xml文件中我们可以这样配置: springmvc org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:config/dispatcher-servlet.xml 2 springmvc *.do springm... 阅读全文
posted @ 2013-12-27 19:41 无忧之路 阅读(15535) 评论(0) 推荐(0) 编辑

无忧之路
点击右上角即可分享
微信分享提示