From the course: Learning Apache Tomcat

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Your first Tomcat application

Your first Tomcat application - Tomcat Tutorial

From the course: Learning Apache Tomcat

Start my 1-month free trial

Your first Tomcat application

- [Instructor] I've included a very simple Hello World application in the exercise files. It's called hello.war. Even though we aren't writing Java in this course, I thought it would help to look at the code to understand how servlets work. The important pieces here are this line here, extends HttpServlet and then on the line right below it, there's this doGet. All of the code for creating servlets and interacting with Tomcat has already been written by people who are way better at Java than I am. That code is available to me as the application author in this generic HttpServlet object. So all my code needs to do is extend that with whatever is specific to my application. In this case that means extending the doGet method, so that it will return Hello world which is right down here. doGet is how the servlet and Tomcat respond to a regular HTTP get request. I could also define doPost for example if I wanted my servlet to respond to HTTP post request. One more thing to note for those…

Contents