[英]Servlet gives 404 (Eclipse + Tomcat)
我正在http://www.vogella.com/articles/EclipseWTP/article.html上学习Lars Vogel的教程,但遇到了404错误。 因此,我在Eclipse中创建了一个Dynamic Web Project,然后根据该教程创建了FileDao.java和FileCounter.java。 Eclipse为我生成了一个web.xml文件,它是:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>de.vogella.wtp.filecounter</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>FileCounter</display-name>
<servlet-name>FileCounter</servlet-name>
<servlet-class>de.vogella.wtp.filecounter.servlets.FileCounter</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FileCounter</servlet-name>
<url-pattern>/FileCounter</url-pattern>
</servlet-mapping>
</web-app>
我正在使用Tomcat 6.0,并且在创建项目时选择了动态Web模块版本2.5。
您尝试访问哪个URL? ...尝试
http://localhost:8080/<Include Your Project Name>/FileCounter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.