1、创建web project SS2
2、导入spring框架,core包、webLibraries包
3、导入struts2框架,core包导入还需要导入struts2-spring-plugin包
注意:可以通过右键选择configure build path,选择Add LibraryMyEclipse libraries,添加所需要的包
4、编写action---cn.edu.njupt.actions.UserAction
5、配置struts.xml
succe.jsp
6、配置web.xml
org.springframework.web.context.ContextLoaderListener
struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
struts2
/*
注意:a、指明applicationContext.xml的位置 b、编写spring的Listener c、struts2的配置信息保持不变
7、配置applicationContext.xml 注意:id需要和Struts.xml中对应Action配置节点中的cla属性(此时的cla属性与action类名无关)保持一致,scope设置为prototype
《struts2与Spring集成步骤.doc》
将本文的Word文档下载到电脑,方便编辑。
推荐度:
点击下载文档