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.

  1. Create a servlet named GoodbyeServlet in the ...labs package.
  2. Be sure the class extends HttpServlet.
  3. Override/implement the doGet() method.
  4. Add to the response a valid HTML document saying "Goodbye World!".

  5. Map the servlet to the URL *.do in src/main/webapp/WEB-INF/web.xml.

  6. This means a request to whatever.do or voo.do will be handled by this servlet.

  7. Add an HTML link in src/main/webapp/index.html to a URL that will reach your servlet, such as inventory.do.

  8. Test the app by running it on Tomcat (Run As->Run on Server).

  9. Open ...examples.HelloWorldServlet. Add a link in the response HTML to your Goodbye servlet.

  10. Test the app.

(Solution: solutions.labs.GoodbyeServlet, solutions.labs.HelloWorldServletWithGoodbye, src/main/webapp/index3.html, solutions.labs.webGoodbye.xml )


Prev -- Up -- Next