O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Key steps for servlet version two

We have two main things to do: recompile the servlet and deploy the model class.

Compiling the servlet

We’ll use the same compiler command that we used when we built the first version of the servlet.

image with no caption

Deploying and testing the web app

Now, in addition to the servlet, we also have to deploy the model. The key steps are:

1 - Move a copy of the servlet .class file to: ../Beer-v1/WEB-INF/classes/com/example/web/ This replaces the version one servlet class file!

2 - Move a copy of the model’s .class file to: ../Beer-v1/WEB-INF/classes/com/example/model/

3 - Shutdown and restart tomcat

image with no caption

4 - Test the app via form.html, the final browser output should be something like:

image with no caption

Beer Selection Advice try: Jack Amber try: Red Moose

image with no caption

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required