Skip to content

Lab 4-2: JSTL

Instructions

Add New Files

Download these files and place them in your tomcat/lib directory.

Important: Stop and start tomcat so that the new jars will be found.


JSP

  1. Create a JSP page named jstl-lab1.jsp. Save it to the projects/public_html/jsp directory.

  2. Add the tag library descriptor tag to the very top.

    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    
  3. Set a variable using the JSTL set tag.

  4. Access the variable later in the HTML with EL.

Servlet

  1. Create a servlet named JSTLLab1Servlet. Place it in the java112.project4 package.

  2. In the doGet() method create a list of String values. Make the values uniquely yours!

  3. Add the list to the request object.
  4. Forward to the following JSP page.
  5. Create a JSP page named jstl-lab2.jsp.
  6. Add the tag library descriptor tag to the very top.

    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    
  7. Access the list in the request and generate an HTML table with its contents.

  8. Deploy your web application and start Tomcat.
  9. Click on the link for the servlet.

Screenshots

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

  1. lab2-servlet.png: The 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 clearly shows the servlet 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.