Notes when using eclipse for the tomcatproject

Source: Internet
Author: User

Because a tomcat project is created in eclipse, it does not automatically generate a web. xml configuration file in the project directory, so you need to manually add and write it. I tried to make a servlet today, but when I wrote the configuration file, I wrote an error in the attribute name of <servlet-Name> so that an error was reported during browsing. Only to find out some of the original details need to be noted, write down and remember.

In the Directory D: \ Tomcat 5.0 \ conf \ Catalina \ localhost of tomcat5.0, eclipse generates a counter. xml file. The Code is as follows:

<? XML version = '1. 0' encoding = 'utf-8'?>
<Context docbase = "D:/javaproject/workspace/counter" Path = "/counter" reloadable = "true" workdir = "D: \ javaproject \ workspace \ counter \ work">
</Context>

 

You should note that the path value is "/counter", which corresponds to the Web created manually in the D: \ javaproject \ workspace \ counter directory. servlet-Name: Counter in the XML file

<? 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>
<Web-app>
<Servlet>
<Servlet-Name> counter </servlet-Name>
<Servlet-class> com. counter1servlet </servlet-class>
</Servlet>
<Servlet-mapping>
<Servlet-Name> counter </servlet-Name>
<URL-pattern>/Counter </url-pattern>
</Servlet-mapping>
<Welcome-file-List>
<Welcome-File> counter </welcome-File>
</Welcome-file-List>
</Web-app>

I used xmlspy to write this file. It was written fast and I didn't pay much attention to it. As a result, I wrote counter into counter and browsed "http: // localhost: 8080/manager/htm ", the project cannot be found in the path column.

If you have read this article, you will also pay attention to it.
The above configuration files, mapping and welcome-file can be modified as needed, but the servlet-name should be noted, because it is also associated with the project configuration file in Tomcat.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.