How do you develop Java servlets using Eclipse?

I would like to program Java servlets using Eclipse, and I plan to deploy them using Tomcat. I think I can build projects using Ant, which is associated with Eclipse. I have a standard Eclipse environment. What are my options for creating a Servlet in Eclipse? What changes need to be made to Eclipse? Do i need to install the plugin?

+63
java eclipse plugins servlets
Oct. 15 '08 at 23:42
source share
3 answers

You need to install the plugin. There is a free eclipse foundation called the web tool platform . It has all the development functionality you need.

You can get Java EE Edition eclipse with a preinstalled preinstallation.

To create and run the first servlet:

  • New ... Project ... Dynamic web project.
  • Right-click the project ... New servlet.
  • Write the code in the doGet() method.
  • Finding a server view in the Java EE perspective is usually one of the tabs below.
  • Right-click and select the new server.
  • Select Tomcat XX, and the wizard will prompt you to find the installation.
  • Right-click the server you just created and select "Add and Remove ..." and add the created web project.
  • Right-click your servlet and choose Run> Run On Server ...

That should do it for you. You can use ant to create here if that is what you want, but eclipse will actually build and automatically deploy the changes to the server. With Tomcat, you may have to restart it every time and again depending on the change.

+104
Oct. 15 '08 at 23:54
source share

I am using Eclipse Java EE edition

Create a Dynamic Web Project

Install the local server in the server view for the version of Tomcat that I am using. Then debug and run on this server for testing.

When deployed, I export the project to a war file.

+7
Oct. 15 '08 at 23:46
source share

Alternatively, you can use Jetty, which is (now) part of the Eclipe platform (Jetty runs on the help system). Jetty also uses Android, Windows Mobile ..

To get started, check out the Eclipse Wiki or if you prefer Video And check out this related post !

+4
Oct. 15 '09 at 18:21
source share



All Articles