【发布时间】:2012-04-05 19:17:51
【问题描述】:
当我将 struts.xml 放入 web-inf 时,它显示错误......当我放入 src 文件夹时,它工作正常。(在 web-inf 中是 applicationcontext.xml)
(在(src 文件夹或 src/resources)中的 struts.xml)当我将 applicationcontext.xml 放在 src 文件夹中时............这是说无法在 web-inf 中找到 applicationcontext.xml文件夹............它无法执行。
我如何配置以便 eclipse 可以找到 struts.xml 或 applicationcontext.xml 的路径,以便无论我放在哪里都应该检测到它。
web.xml中的代码如下。
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
谢谢大家。
【问题讨论】:
-
我不认为您可以配置 eclipse,以便无论您保留 struts.xml 或 applicationcontext.xml,它都会被接受。最好将 struts.xml 保存在 src 文件夹中,将 applicationcontext.xml 保存在 web-inf 中。 kandarp 给出的答案将有助于为 spring 指定 applicationcontext.xml 的路径。我不认为这样的东西可用于 struts2。
标签: java eclipse spring struts2