Spring MVC JSP List View

Descripción

Create a JSP list view for displaying all items


File Template: ✅


Prefix

jsp:list


Scopes

jsp


Snippet de código

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
	<title>${1:List}</title>
</head>
<body>
	<h1>${2:Lista de items}</h1>
	<a href="${3:/new}">Crear nuevo</a>
	<table border="1">
		<thead>
			<tr>
				<th>ID</th>
				<th>Name</th>
				<th>Acciones</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="item" items="${items}">
				<tr>
					<td>${item.id}</td>
					<td>${item.name}</td>
					<td>
						<a href="${item.id}">Ver</a> |
						<a href="${item.id}/edit">Editar</a> |
						<form action="${item.id}/delete" method="post" style="display:inline">
							<button type="submit">Eliminar</button>
						</form>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
</body>
</html>