JSTL in Servlet Tomcat 7
Tomcat 7 does not come with JSTL jar files by default.
First, locate the jar files for both JSTL API and JSTL Implementation. They are located on the JSP Standard Tag Library download page. Click into each repository and find the .jar file.
Tomcat 7
=>Servlet -api-3.0
=>JSTL-1.2
Servlet
Download Servlet -api-3.0
JSTL
JSTL API jar - javax.servlet.jsp.jstl-api-1.2.1.jar.
JSTL Implementation jar -javax.servlet.jsp.jstl-1.2.1.jar.
After download jar file past that file into /WEB-INF/lib
Now create a simple JSP page that uses one of the JSTL Tag Libraries.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Show Account List</title>
</head>
<body>
<c:if test="${not empty allAccountList}">
<table style="width="100%" border="1" cellpadding="2" cellspacing="2" style="background-color: #ffffff;" >
<th>Account Number</th>
<th>Customer Name</th>
<th>Current Balance</th>
<th>Maximum Balance</th>
<th>Account Type</th>
<th>Account Pin</th>
<c:forEach var="accountList" items="${allAccountList}">
<tr>
<td>${accountList.accountNumber_}</td>
<td>${accountList.customerName_}</td>
<td>${accountListt.accountBalance_}</td>
<td>${accountList.accountMaximumBalance_}</td>
<td>${accountList.accountType_}</td>
<td>${accountList.accountPin}</td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>
web.xml
Note: Not compulsory for that modification in web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Define servlets that are included in-->
<!-- servlet mappings s>
</web-app>
web.xml
Note: Not compulsory for that modification in web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<!-- Define servlets that are included in-->
<!-- servlet mappings s>
</web-app>