web.xml文件配置如下。只是做了一个简单的登录功能,我把struts.xml移到src目录下没问题。
请问一下正确的做法struts.xml应该放在那个位置,如果是想要放在web-inf下面应该怎么做<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts 2.0 test xp1204</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</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*:test/spring/applicationContext*.xml
</param-value>
</context-param>
</web-app>
请问一下正确的做法struts.xml应该放在那个位置,如果是想要放在web-inf下面应该怎么做<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts 2.0 test xp1204</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</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*:test/spring/applicationContext*.xml
</param-value>
</context-param>
</web-app>
在struts1.x中默认的为WEB-INF目录下也没有规定什么文件必须放在什么路径下,这些路径好像也可以修改(不记得咋的修改了)
就用它默认的感觉就不错
配置文件不是在src底下就是WEB-INF下
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
../test/spring/applicationContext*.xml
</param-value>
</context-param>
将struts.xml放在src目录下,会自动将struts.xml放在classes中去