What is JSTL?
- JSTL is used to avoid java coding in JSP.
- The JavaScript pages standard Library(JSTL) encapsulates core functionality common to many JSP applications .
- JSTL has core tags for iterators,conditionals for handling flow control,etc,formatting tags for supporting internationlaization,tags for accessing database using SQL,tags for manipulating XML documents, and tags for commonly used functions.
- The JSTL tags are classified according to their functionality. The UEI,s for the libraries as follows
1.JSTL core tags
<%@tagliburi=”http://java.sun.com/jsp/jstl/core” prefix=”c”%>
2.JSTL formatting tags
<%@tagliburi=”http://java.sun.com/jsp/jstl/fmt” prefix=”fmt”%>
3.JSTL SQL tags
<%@tagliburi=”http://java.sun.com/jsp/jstl/sql” prefix=”sql”%>
4JSTL XML/XSL tags
<%@tagliburi=”http://java.sun.com/jsp/jstl/xml” prefix=”x”%>
5.JSTL function tags
<%@tagliburi=”http://java.sun.com/jsp/jstl/functions” prefix=”fn”%>
- To use the JSTL core tags in JSP we need to do the folowing two steps.
step1:Use the <taglib>directive in the JSP
<%@tagliburi=”http://java.sun.com/jsp/jstl/core” prefix=”something”%>
step2:Add jstl.jar and standard.jar to lib folder of your web application.The location of these two jars is present in apache-tomcat\webapps\examples\WEB-INF\lib folder
Groupings of Actions
In all, there are fourteen actions contained in the JSTL core library. This table briefly summarizes the actions in each group.
Groups | Action | Purpose |
General Purpose | <c:out>
<c:set> <c:remove> <c:catch> |
Manipulating attributes, controlling
output to the JSPWriter, catching exceptions |
Conditional | <c:if>
<c:choose> <c:when> <c:otherwise> |
Control flow (branching) |
Iteration | <c:forEach>
<c:forTokens> |
Control flow (looping) |
URL-Related | <c:import>
<c:url> <c:redirect> <c:param> |
Use of other resources |
0 responses on "JSTL"