Labs
In this lab we will add our own servlet to the web application, and change the existing servlet to display a link that leads to the new servlet.
- Create a servlet named
GoodbyeServletin the...labspackage. - Be sure the class extends
HttpServlet. - Override/implement the
doGet()method. -
Add to the response a valid HTML document saying "Goodbye World!".
-
Map the servlet to the URL
*.doinsrc/main/webapp/WEB-INF/web.xml. -
This means a request to
whatever.doorvoo.dowill be handled by this servlet. -
Add an HTML link in
src/main/webapp/index.htmlto a URL that will reach your servlet, such asinventory.do. -
Test the app by running it on Tomcat (Run As->Run on Server).
-
Open
...examples.HelloWorldServlet. Add a link in the response HTML to yourGoodbyeservlet. -
Test the app.
(Solution: solutions.labs.GoodbyeServlet, solutions.labs.HelloWorldServletWithGoodbye, src/main/webapp/index3.html, solutions.labs.webGoodbye.xml )