Skip to content

Lab 2 - Linking

Instructions

  1. If you have not already created your home page then now’s the time! Create a static HTML page and place it in your projects/public_html directory. It should be named index.jsp. Put something on the page identifying it as your home page.
  2. Create another static HTML page named linkingDemo.html and place it in your projects/public_html directory.
  3. Add an <a href> tag to your index.jsp page that points to: “linkingDemo.html”
  4. On the linkingDemo page add two links back to the home page:
    1. The first link should have an href of /java112/index.jsp. The link text should read, “Wrong way to link to the home page”.
    2. The final link should have an href of /java112. The link text should read, “Right way to link to the home page!”.
  5. Add yet another link to the demo link page. It should have an href of /java112/trivial. The link text should read, “Right way to link to servlets”.
  6. Launch Tomcat and try all the links.

Bonus Task 1

Add a link to TrivialServlet (Optional)

  1. Open TrivialServlet.java in your editor.
  2. Add a link, using an <a href> tag, to the servlet such that the link points to the home page (index.jsp).
  3. Test your changes by deploying, and then clicking the new link in TrivialServlet.

Bonus Task 2

Add an Image to TrivialServlet (Optional)

  1. Open TrivialServlet.java in your editor.
  2. Add code to display an image of your choosing in the servlet.
  3. Test your changes by deploying, and then viewing TrivialServlet in the browser.

Screenshots

To receive credit for this lab save a screenshot in the projects/screenshots/week6 directory.

  1. Add something uniquely yours to linkingDemo.html, if you haven't already. Redeploy and view the page in your browser to see your changes.
  2. lab2-linking-servlet.png: The updated servlet running in the browser.

Add, commit, and push and verify all work, including screenshots are visible in GitHub.


Rubric

All of the following must be satisfied to achieve a "Met" status

  • Screenshot should clearly show linkingDemo.html running in the browser.
  • Code and screenshots are properly named and saved in the correct directory.
  • All lab steps have been accurately and appropriately implemented.
  • Code adheres to the course coding standards.
  • Commit messages are concise, atomic, and effectively describe the change(s) made.
  • JavaDoc documentation is properly implemented, providing clarity and understanding of the code's functionality and usage.
  • External sources (websites, classmates, AI tools, etc), if utilized, are referenced and documented within the code as comments.

Additional Considerations

  • Only course materials and previous learning are used to completed this lab (no session tracking).