Lab 2 - Linking
Instructions
- 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.
- Create another static HTML page named linkingDemo.html and place it in your projects/public_html directory.
- Add an
<a href>
tag to your index.jsp page that points to:“linkingDemo.html”
- On the linkingDemo page add two links back to the home page:
- The first link should have an href of
/java112/index.jsp
. The link text should read, “Wrong way to link to the home page”. - The final link should have an href of
/java112
. The link text should read, “Right way to link to the home page!”.
- The first link should have an href of
- 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”. - Launch Tomcat and try all the links.
Bonus Task 1
Add a link to TrivialServlet (Optional)
- Open TrivialServlet.java in your editor.
- Add a link, using an
<a href>
tag, to the servlet such that the link points to the home page (index.jsp). - Test your changes by deploying, and then clicking the new link in TrivialServlet.
Bonus Task 2
Add an Image to TrivialServlet (Optional)
- Open TrivialServlet.java in your editor.
- Add code to display an image of your choosing in the servlet.
- 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.
- Add something uniquely yours to
linkingDemo.html
, if you haven't already. Redeploy and view the page in your browser to see your changes. 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).