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
-
Create a JSP page named jstl-lab1.jsp. Save it to the projects/public_html/jsp directory.
-
Add the tag library descriptor tag to the very top.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
Set a variable using the JSTL
set
tag. - Access the variable later in the HTML with EL.
Servlet
-
Create a servlet named JSTLLab1Servlet. Place it in the java112.project4 package.
-
In the doGet() method create a list of String values. Make the values uniquely yours!
- Add the list to the request object.
- Forward to the following JSP page.
- Create a JSP page named jstl-lab2.jsp.
-
Add the tag library descriptor tag to the very top.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-
Access the list in the request and generate an HTML table with its contents.
- Deploy your web application and start Tomcat.
- Click on the link for the servlet.
Screenshots
To receive credit for this lab save a screenshot in the projects/screenshots/week13
directory.
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.