简体   繁体   English

Servlet提供404(Eclipse + Tomcat)

[英]Servlet gives 404 (Eclipse + Tomcat)

I'm learning with Lars Vogel's tutorial on http://www.vogella.com/articles/EclipseWTP/article.html and I'm stuck with a 404 error. 我正在http://www.vogella.com/articles/EclipseWTP/article.html上学习Lars Vogel的教程,但遇到了404错误。 So I created a Dynamic Web Project in Eclipse and then created FileDao.java and FileCounter.java according to the tutorial. 因此,我在Eclipse中创建了一个Dynamic Web Project,然后根据该教程创建了FileDao.java和FileCounter.java。 And Eclipse generated a web.xml file for me, here it is: 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>

I'm using Tomcat 6.0 and I chose Dynamic web module version 2.5 while creating the project. 我正在使用Tomcat 6.0,并且在创建项目时选择了动态Web模块版本2.5。

What URL are you trying to access? 您尝试访问哪个URL? ... Try ...尝试

http://localhost:8080/<Include Your Project Name>/FileCounter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM