Skip to main content

Posts

Showing posts with the label JSTL

JSTL Example

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>   <%@ taglib prefix="c" uri="/x" %>   <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body>       <c:out value="From JSTL Core Tag"></c:out>     <br/>     <c:catch> What is here?? </c:catch>     <c:set var="counter" value="1"></c:set>     <c:forEach begin="1" end="5" step="1">         <c:out value="${counter}"> </c:out>         <c:set var="counter" value="${counter}}"> </c:set>     </c...

Steps for using JSTL

1. Download jstl.jar from http://www.java2s.com/Code/Jar/JKL/Downloadjstljar.htm   2. Download standard.jar from http://www.java2s.com/Code/Jar/JKL/Downloadstandardjar.htm   3. Extract and add the tlds in WEB-INF/lib folder by copy paste.   4. Edit Web.xml    for all such tlds   <jsp-config> <taglib>     <taglib-uri> /x </taglib-uri>     <taglib-location> /WEB-INF/lib/c.tld </taglib-location> </taglib> </jsp-config>   5. Now in the jsp file add   <%@ taglib prefix="c" uri="/x" %>   6. Start using tags       e.g. <C:out value="output this"> </c:out>