随笔分类 - SpringMVC
摘要:@Controller@RequestMapping(value = "/test")public class TestController { @RequestMapping("/addUser") public void addUser(@ModelAttribute(value =...
阅读全文
摘要:@RequestMapping(value = "/getForm") @ResponseBody public List getForm(String pid) { return new ArrayList(){{ add("你好") }}; }
阅读全文
摘要:SpringMVC的controller是单例的,因此springMVC的controller不是线程安全的,在使用的时候要谨慎添加成员变量,因为所有的请求都会共享这个变量。与springMVC不同的是,struts2可以使用prototype来管理action,也就是说使用了prototype这种方式的话,action就是线程安全的了,action中的成员变量只提供给该请求。
阅读全文
摘要:一个servlet可以配置多个servlet-mapping,因此在xml文件中我们可以这样配置: springmvc org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:config/dispatcher-servlet.xml 2 springmvc *.do springm...
阅读全文