OK, we’ve built, deployed, and tested our HTML, and we’ve built and deployed our DD (well, we put the web.xml into the deployment environment, but technically the DD won’t be deployed until we restart Tomcat). Now it’s time to compile the first version of the servlet, deploy it, and test it via the HTML form. Now we’ll restart Tomcat to make sure that it “sees” the web.xml and servlet class.
Compiling the servlet
Compile the servlet with the -d flag to put the class in the development environment.
Deploying the servlet
To deploy the servlet, make a copy of the .class file and move it to the /Beer-v1/WEB-INF/classes/com/example/web/ directory in the deployment structure.
Testing the servlet
1 - Restart tomcat!
2 - Launch your browser and go to: http://localhost:8080/Beer-v1/form.html
4 - Select a beer color and hit “Submit”
5 - If your servlet is working, you should see the servlet’s response in your browser as something like:
Beer Selection Advice Got beer color brown