For-each
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!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>Gyansetu</title>
</head>
<body>
Login Successful
<br> Hello ${username}
<br> After dispatching ${user} After loading ${messages.hello}
<br>
<table border="1" cellpadding="5" cellspacing="1">
<tr>
<th>id</th>
<th>name</th>
<th>price</th>
<th>edit</th>
<th>delete</th>
</tr>
<c:forEach items="${productList}" var="product">
<tr>
<td>${product.id}</td>
<td>${product.name}</td>
<td>${product.price}</td>
<td><a href="editProduct?id=${product.id}">Edit</a></td>
<td><a href="deleteProduct?id=${product.id}">Delete</a></td>
</tr>
</c:forEach>
</table>
</body>
</html>
Last updated
Was this helpful?