Create Servlet with Eclipse

Posted on 2006-04-04
Last Modified: 2008-01-09
I am writing servlet by Eclipse, and I am using Tomcat 4.0 as my container. What I do is using the "classes" folder as the workspace and create package inside it. Is this a common way to develop servlet?
Question by:william007
    LVL 92

    Assisted Solution

    have a look at Web tools project
    LVL 11

    Accepted Solution


    Following points need to be noted to create a servlet

    1) Irrespective of where the source folder is in the project, the output folder should be WEB-INF/classes. It means the compiles classes should be placed inside the WEB-INF/classes folder.

    2) To create a Servlet, you definitely has to extend the javax.servlet.http.HttpServlet class.

    public class HelloServlet extends HttpServlet

    3)now,  servlet mapping should be in web.xml like the following


    4) restart tomcat and look


    to learn more about servlets


    LVL 19

    Assisted Solution

    I think the better option is to download sysdeo plug in for tomcat... ( you can extract the zip file in your eclipse\plugins folder)..
    after this you can create a "tomcat project" in eclipse..

    new-->project-->java-->tomcat project

    it takes care of your code base & what class goes where type problems..
    also you can debug your servlets if needed...
    LVL 9

    Author Comment


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    Synchronize a new Active Directory domain with an existing Office 365 tenant
    OfficeMate Freezes on login or does not load after login credentials are input.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now