salut
j'essaye de mettre le valeur d'un input dans un parametre pour le transmettre a ma servlet , mais j'y arrive pas
votre aide me sera d'une gande utilité 
ma page jsp :
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| <%@ 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"%>
<jsp:useBean id="produitService" class="com.project.service.ProduitService"></jsp:useBean>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>L'inventaire</title>
<link type="text/css" rel="stylesheet" href="<c:url value="/css/style.css"/>" />
</head>
<body>
<c:import url="/menuGestion.jsp" />
<div id="corps">
<fieldset>
<legend>L'inventaire</legend>
<c:choose>
<%-- Si aucun produit n'existe en base de donnée, affichage d'un message par défaut. --%>
<c:when test="${ empty produitService.findAll() }">
<p class="erreur">Entrepot vide.. !</p>
</c:when>
<%-- Sinon, affichage du tableau. --%>
<c:otherwise>
<table>
<tr>
<th>Code produit</th>
<th>Description</th>
<th>Type</th>
<th>Quantité en Stock</th>
<th>Stock minimum</th>
<th class="action">Valider</th>
</tr>
<%-- Parcours la liste des produits en BD, et utilisation de l'objet varStatus. --%>
<c:forEach items="${ produitService.findAll() }" var="produits" varStatus="boucle">
<%-- Simple test de parité sur l'index de parcours,pour alterner la couleur de fond de chaque ligne du tableau. --%>
<tr class="${boucle.index % 2 == 0 ? 'pair' :'impair'}">
<%-- Affichage des propriétés du bean produits, qui est stocké en tant que valeur de l'entrée courante de la map --%>
<td><c:out value="${ produits.codeProduit}" /></td>
<td><c:out value="${ produits.description}" /></td>
<td><c:out value="${ produits.type.libelle}" /></td>
<td><c:out value="${ produits.quantiteEnStock}" /></td>
<td><input type="text" id="min" name="min" value="<c:out value="${produits.stockMin}"/>" onChange="javascript:document.getElementById('produitStkMin').value = document.getElementById('min').value" size="10" maxlength="30" />
<span class="erreur">${form.erreurs['min']}</span>
</td>
<%-- Lien vers la servlet de validation, avec passage l'id du produit en paramètre grâce à la balise <c:param/>. --%>
<td class="action">
<a href="<c:url value="/modificationProduit"><c:param name="idProduit" value="${produits.idProduit }" />
<c:param name="produitStkMin" value="" /></c:url>">
<button type="submit"> <img src="<c:url value="/images/valider.png"/>" alt="Valider" /></button>
</a></td>
</tr>
</c:forEach>
</table>
</c:otherwise>
</c:choose>
</fieldset>
</div>
</body>
</html> |
l'input en question:
<input type="text" id="min" name="min" value="<c:out value="${produits.stockMin}"/>" onChange="javascript:document.getElementById('produitStkMin').value = document.getElementById('min').value" size="10" maxlength="30" />
le param:
<c:param name="produitStkMin" value="" />
quand je teste la valeur du paramètre est null..
merci encore
Partager