Servlets

 

Creating servlet projects

You can use the New project wizard to create servlet applications. Choose the Project | New... menu entry and select the Web application (Servlet) project type.

 

After creating the project you can test the sample servlet by choosing Project | Run. The servlet engine startup message will be displayed in the Output Window:

 

 

The servlet engine is started on the local machine port 8080.

 

Point your browser to http://localhost:8080 and follow the link to access the sample servlet.

 

Debugging servlets

You can debug web applications just like other applications by choosing Debug | Run.

 

A good way to debug servlets is to set a breakpoint in the doGet() or doPost() method of the servlet:

 

 

As soon as the servlet is accessed the debugger stops at the breakpoint.

 

Please note that the browser can time-out waiting for the response from the servlet when you step through the servlet code.