问题描述
- tomcat修改了context doc-base为项目里面的文件夹后项目的servlet找不到
- 我的项目名称叫drivproj,里面有个文件夹叫offsite,我在tomcat的server.xml里将context doc-base修改为drivproj/offsite,那么我原先在drivproj/web-inf里的web.xml里添加的servlet就不起作用了!运行当用到servlet的时候提示找不到该名称!
求大神帮忙!急急急!
另附WEB.XML:
<?xml version=""1.0"" encoding=""utf-8""?><!DOCTYPE web-app
PUBLIC ""-//Sun Microsystems Inc.//DTD Web Application 2.3//EN""
""http://java.sun.com/dtd/web-app_2_3.dtd"">
<display-name>My Web Application</display-name><description>A application for driver.</description><context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:/spring/*.xml</param-value> <!-- --></context-param><listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><servlet> <servlet-name>spring-mvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:/spring/springmvc-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup></servlet><servlet-mapping> <servlet-name>spring-mvc</servlet-name> <url-pattern>*.json</url-pattern></servlet-mapping><servlet> <servlet-name>sponsor</servlet-name> <servlet-class>com.news.Sponsorsendmail</servlet-class> <load-on-startup>1</load-on-startup></servlet><servlet-mapping> <servlet-name>sponsor</servlet-name> <url-pattern>/sponsor</url-pattern></servlet-mapping><!--编码过滤器--> <filter> <filter-name>encodingFilter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>false</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file></welcome-file-list>
时间: 2024-11-01 19:58:57