Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i configure applicationcontext.xml in eclipse

when i put struts.xml in web-inf it is showing error......when i put in src folder it is working fine.(being applicationcontext.xml in web-inf)

(being struts.xml in (src folder or src/resources)) when i put applicationcontext.xml in src folder.........it is saying that unable to find applicationcontext.xml in web-inf folder...........it is not able to execute.

how do i configure so that eclipse can find the path of struts.xml or applicationcontext.xml so that wherever i put it should detect it.

the code in web.xml is as follows.

<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>

Thank you all.

like image 287
user533 Avatar asked Mar 29 '26 22:03

user533


1 Answers

if you are putting in web-inf folder

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

if you are putting in src/resource folder

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:applicationContext*.xml</param-value>
    </context-param>

one more thing if you get the error like the below link after doing modification.

http://www.bpjava.net/Struts2_Configuration_Plugin/config-browser/showBeans.action

the solution is given at end.

or you can do the following.

in struts.xml <constant name="struts.devMode" value="false" />

like image 168
user533 Avatar answered Apr 02 '26 13:04

user533



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!