首先看看工程的web.xml文件
指定web应用的根, 为WebAppRootListener,Log4jConfigListener使用
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>petstore.root</param-value>
</context-param>
指定log4j配置文件位置
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
配置文件,-local为后缀的是单数据库,-jta的为多数据库时
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/dataAccessContext-local.xml /WEB-INF/applicationContext.xml
</param-value>
<!--
<param-value>
/WEB-INF/dataAccessContext-jta.xml /WEB-INF/applicationContext.xml
</param-value>
-->
</context-param>
启动时ContextLoaderServlet会装入上述配置文件
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
spring MVC servlet 使用这个,会生成一个工程名+-servlet.xml的文件作为映射配置文件.也就是说,在本例子里会生成web-inf目录下生成jpetstore-servlet.xml,用于分发配置.
<servlet>
<servlet-name>petstore</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
struts的servlet,用于struts中request的请求映射,配置文件是struts-config.xml
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
设置要处理的url,这里,注释了名为action的servlet,用了petstore.也就是说,没有使用struts而是使用的spring MVC
<servlet-mapping>
<servlet-name>petstore</servlet-name>
<!--
<servlet-name>action</servlet-name>
-->
<url-pattern>*.do</url-pattern>
</servlet-mapping>
指定web应用的根, 为WebAppRootListener,Log4jConfigListener使用
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>petstore.root</param-value>
</context-param>
指定log4j配置文件位置
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
配置文件,-local为后缀的是单数据库,-jta的为多数据库时
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/dataAccessContext-local.xml /WEB-INF/applicationContext.xml
</param-value>
<!--
<param-value>
/WEB-INF/dataAccessContext-jta.xml /WEB-INF/applicationContext.xml
</param-value>
-->
</context-param>
启动时ContextLoaderServlet会装入上述配置文件
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
spring MVC servlet 使用这个,会生成一个工程名+-servlet.xml的文件作为映射配置文件.也就是说,在本例子里会生成web-inf目录下生成jpetstore-servlet.xml,用于分发配置.
<servlet>
<servlet-name>petstore</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
struts的servlet,用于struts中request的请求映射,配置文件是struts-config.xml
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
设置要处理的url,这里,注释了名为action的servlet,用了petstore.也就是说,没有使用struts而是使用的spring MVC
<servlet-mapping>
<servlet-name>petstore</servlet-name>
<!--
<servlet-name>action</servlet-name>
-->
<url-pattern>*.do</url-pattern>
</servlet-mapping>