[ Team LiB ] Previous Section Next Section


The Workshop is designed to help you review what you have learned, and help you to further increase your understanding of the material covered in this hour.



What steps do you need to take before you can use JSTL in a JSP?


What JSTL tag would you use to write the value of a variable?


How do you find the length of a collection or a string?



Copy the JSTL JAR file(s) to your WEB-INF/lib directory, then add a <taglib> declaration to your web.xml file. Finally, add a <% taglib %> declaration to the top of your JSP.


The <c:out> tag writes out the value of a variable and can also display a default value if the variable is null.


The JSTL functions library provides a number of utility functions, including fn:length, which returns the length of a string or a collection.


  1. Create a JSP that uses the <c:set> tag to store several variables in the current request (use "request" as the scope name), and then forwards to a second JSP. In the second JSP, use the <c:out> tag to display the variables you stored.

  2. Create a JSP that uses <c:forEach> and <c:out> to display the request header variables. Use the implicit header and headerValues objects to enumerate through the header names and their values.

    [ Team LiB ] Previous Section Next Section