bonjour

l' application afficher que en tête mais les contenus de données

merci pour votre aide

voici fichier productlist.jsp

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
<!DOCTYPE html >
<%@  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' %>
<%@  taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
 
<html>
<head>
   <title>Product</title>
</head>
<body>
	<h1>Product</h1>
 <form:form  method="POST"  action="">
	<table border="1" >
	  <thead>
		<tr>
			<td>Name</td>
			<td>Price</td>
			<td>Quantity</td>
			<td colspan=2>Actions</td>
 
		</tr>
	 </thead>
	 <tbody>	
		<c:forEach items="${productList}" var="product">
			<tr>
			   <td><c:out value="${product.name}"/></td> 
				<td>${product.price} euros</td>
				<td>${product.quantity}</td> 
			    <td><a href="<c:url value='/product/edit?id=${product.id}'/>">Edit</a></td>
		    </tr>
		</c:forEach>
	</tbody>	
	</table>
 
 
	<br/>
 
	<a href="<c:url value='/'/>">home page</a><br/>
</form:form>	
</body>
</html>
voici le contrôleur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
 
@Controller
public class ProductListController {
 
	@Autowired ProductRepository productRepository;
 
	@RequestMapping("/productlist")
	public ModelAndView showProductList() {
		ModelAndView mv = new ModelAndView("productlist");
		List<Product> list = productRepository.findAll();
		mv.addObject("productList",list);
        return mv;
	}
 
}