Spring和struts2整合
Spring和struts2整合
1,导入jar包,(struts2的包,Spring的包,还有 struts2-spring-plugin-2.3.32.jar)
2,创建struts2.xml 和applicationConten.xml配置文件
3,配置web.xml,Spring监听,和struts2的过滤器
4,创建action 继承actionsupport
5,在applicationConten.xml中实例化action
6, 修改struts.xml配置(class调用applicationContext.xml中class对应的id)
1 导入jar包,(struts2的包,Spring的包,还有 struts2-spring-plugin-2.3.32.jar)
2,创建struts2.xml 和applicationConten.xml配置文件
3,配置web.xml,Spring监听,和struts2的过滤器
4,创建action 继承actionsupport
5,在applicationConten.xml中实例化action
6, 修改struts.xml配置(class调用applicationContext.xml中class对应的id)
最后写一个hello.xml页面,
上述代码布置完成后也就该测试,但是在测试之前一定要将applicationConten.xml放在WEB-INF文件夹下边,访问http://localhost:8080/Struts_Spring/action路径即可。