java-如何在Eclipse中配置applicationcontext.xml

java-如何在Eclipse中配置applicationcontext.xml,第1张

概述当我将struts.xml放入web-inf时显示错误......当我将src文件夹放入时,它工作正常.(在web-inf中为applicationcontext.xml)当我将applicationcontext.xml放在src文件夹中时(在(src文件夹或src / resources)中为struts.xml).......这就是说无法在web-in

当我将struts.xml放入web-inf时显示错误……当我将src文件夹放入时,它工作正常.(在web-inf中为applicationcontext.xml)

当我将applicationcontext.xml放在src文件夹中时(在(src文件夹或src / resources)中为struts.xml)…….这就是说无法在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>

谢谢你们.最佳答案像下面这样在web.xml中配置context-param:

<context-param>    <param-name>contextConfigLocation</param-name>    <param-value> /WEB-INF/application-context.xml</param-value>  </context-param>

并将您的application-context.xml放在WEB-INF文件夹中. 总结

以上是内存溢出为你收集整理的java-如何在Eclipse中配置applicationcontext.xml 全部内容,希望文章能够帮你解决java-如何在Eclipse中配置applicationcontext.xml 所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1237098.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-06
下一篇 2022-06-06

发表评论

登录后才能评论

评论列表(0条)

保存