读书人

Spring 怎么读取 jar包中的 applicati

发布时间: 2011-12-05 22:12:57 作者: rapoo

Spring 如何读取 jar包中的 applicationContext-*.xml文件 很郁闷啊 搞了我两天了
classpath*:applicationContext-*.xml
只能读取到当前项目中的文件
可jar中文件就是拿不到...
找了两天资料都没发现实用的 真郁闷
大家帮帮忙了

[解决办法]

在web.xml文件中
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext-*.xml,/WEB-INF/applicationContext-*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>



struts-config.xml文件中
<!-- 增加用户信息 -->
<action path="/regist"
type="org.springframework.web.struts.DelegatingActionProxy"
name="userForm"
parameter="insertUser"
scope="request"
>
<forward name="success" path="/regist.jsp"></forward>
</action>

读书人网 >J2EE开发

热点推荐