您的位置:首页 > 业界新闻

SSH整合开发的技术思考

2013-12-24 16:53 281 查看
ssh整合开发,互联网上上可以找到很多必要的jar包,把需要的包加入就可以实现,搭建的框架,而且这个比较简单,struts.xml和applicationcontext.xml,归根结底加载到这个文件实在web-inf的目录下实现,所以在配置文件找不到时可以,可以把配置文件copy到wen-inf下:
web.xml配置:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
struts2.xml配置:
<struts>
<package name="exam-default" extends=""struts-default"">
<action path="/deviceAPVersionAction" type="com.action.deviceAPVersionAction" scope="request" parameter="method" >
<forward name="init" path="/webtv/deviceappstoreversionconfig/deviceAppStoreVersionConfig.jsp">
</forward>
</action>
//这个plug-in将struts的处理转给Spring了,由Spring IOC控制调用Struts中的组件,这样你就需要在Spring那个applicationContext.xml中加入Action相应的bean类
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml"/>
</plug-in>
</package>
</struts>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息