Testing Tomcat

To test the server—assuming you’re running Tomcat on the same machine as the browser and that you’re using the default port for Tomcat (8080)—open a browser and enter the following URL in the Location/Address field:

http://localhost:8080/

The Tomcat main page is shown in the browser (see Figure 4.2), and you can now run all servlet and JSP examples bundled with Tomcat to make sure everything works.

The Tomcat main page

Figure 4-2. The Tomcat main page

When you’re done testing Tomcat, stop the server like this:

C:\Jakarta\jakarta-tomcat\bin>shutdown

You should always stop the server this way, as opposed to killing the Command Prompt window the server is running in. Otherwise, the applications don’t get a chance to close down gracefully, and when you start to connect external resources, like a database, various problems may occur.

Get Java Server Pages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.