Download presentation
Presentation is loading. Please wait.
Published byKathleen Cain Modified over 9 years ago
1
Chapter 9 Using JSTL
2
Sometimes you need more than EL or standard actions What if you want to loop through the data in an array, and display one item per row in an HTML table? – You could write scriptlet. – But you are trying to get away from scripting – EL and standard actions may not be enough for this situation The solution is custom tags – They are as easy to use in a JSP as standard actions – They are bundled in JSP Standard Tag Library (JSTL)
3
JSTL JSTL is not part of the JSP specification – Having access to the Servlet and JSP APIs doesn’t mean you have access to JSTL Before you can use JSTL, you need to put two files, “jstl.jar” and “standard.jar” into the WEB-INF/lib directory of your web app – That means each web app needs a copy In our installation of Tomcat 7, you can get these files from the following directory of the example JSP/Servlet application: webapps/jsp-examples/WEB-INF/lib/jstl.jar webapps/jsp-examples/WEB-INF/lib/standard.jar
4
Looping without scripting Imaging you want something that loops over a collection (say, an array of catalog items), pulls out one element at a time, and print that element in a dynamically-generated table row – The tag is the answer
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.