Bonsoir/Bonjour,
Je veux afficher sur la page panier.jsp avec Les EL le résultat d'une collection (listeProduits qui est déja remplit).Voici mon morceau de code que j'ai écrit sur la servlet.Que doit je écrire sur la page panier.jsp alors ??
Merci beaucoup.
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
 
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 
		PrintWriter pw = response.getWriter();
		HttpSession session = request.getSession();
 
		List<String> listeProduits = (List<String>) session.getAttribute("produits");
 
    if (listeProduits == null) {
	listeProduits = new ArrayList<String>();
	session.setAttribute("produits", listeProduits);
     }
   pw.print(session.getId() + "<br/>");
 
   if (request.getParameter("action").equalsIgnoreCase("ajouter")) {
	   listeProduits.add(request.getParameter("produit"));
		pw.print("Produit ajouté avec succés");
 
   }else{
 
	for (String prod : listeProduits) {
		pw.println("<li>" + prod + "</li>");
 
	}
	request.setAttribute("pan",listeProduits);
	RequestDispatcher dispatch = request
	.getRequestDispatcher("/panier.jsp");
   dispatch.forward(request, response);
   }
 
	}