Génération dynamique d'un tableau
Bonsoir à tous,
voilà j'ai encore un petit problème.
je génère automatique sur une page jsp un tableau avec divers informations et à la fin de chaque ligne on peux mettre une quantité et un bouton ajouter si trouve également
la valeur du input est du texte avec un id du produit qui viens se coller.
le but est par la suite que l'on clique sur le bouton se trouvant sur la ligne du produit que l'on veux ajouter, et de récuper la valeur de cette input.
je l'ai fait pour un projet en php et aucun problème, par contre en jsp quand je fait dans ma servelet response.getParameter("lavaleur") hé bien là je suis bloqué car je n'ai aucune idée de la valeur, puisqu'elle est générer automatiquement.
pourriez vous m'aider, me donner une piste ?
encore un grand merci
voici une partie du code de la jsp (je sais pas bien je dois utiliser des usebean)
Code:
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 66 67 68
| <form name="form_add_caddy" id="form_add_caddy" action="<%=request.getContextPath()%>/CaddyTempo" method="get">
<table summary="Liste complete du catalogue">
<caption>Liste complète du catalogue evynile</caption>
<colgroup>
<col span="1" width="300" style="background-color: #B8C7D3" />
<col span="1" width="600" style="background-color: #B8C7D3" />
<col span="1" width="200" style="background-color: #B8C7D3" />
<col span="1" width="100" style="background-color: #B8C7D3" />
<col span="1" width="200" style="background-color: #B8C7D3" />
<col span="1" width="50" style="background-color: #B8C7D3" />
<col span="1" width="100" style="background-color: #B8C7D3" />
<col span="1" width="100" style="background-color: #7EBABE" />
</colgroup>
<!-- Titre du tableau entête -->
<thead>
<th>Titre</th>
<th>Description</th>
<th>Interprete</th>
<th>Année</th>
<th>Prix</th>
<th>Stock</th>
<th>Quantité souhaitée</th>
</thead>
<tfoot>
<td colspan="6">
<center>
<p>Fin du catalogue</p>
</center>
</td>
</tfoot>
<tbody>
<%
for (int i = 0; i < allData.size(); i++) {
%>
<tr>
<td><%=allData.get(i).getTitre()%></td>
<td><%=allData.get(i).getDescription()%></td>
<td><%=allData.get(i).getInterprete()%></td>
<td><%=allData.get(i).getAnnee()%></td>
<td><%=allData.get(i).getPrix()%> euro(s)</td>
<td align="center">
<%
int stock = Integer.parseInt(allData.get(i).getStock());
if (stock==0){%> <img src="images/rouge.png"
alt="Etat de stock"> <%}%>
<%if (stock<=5 && stock>0){%> <img src="images/orange.png"
alt="Etat de stock"> <%}%>
<%if (stock>5){%> <img src="images/vert.png"
alt="Etat de stock"> <%}%>
</td>
<td align="center"><input type="text"
title="Entrer la quantité souhaitée" name="qte<%=allData.get(i).getIdArticle() %>" id="qte<%=allData.get(i).getIdArticle() %>" value="0" style="width: 20px;"
/></td>
<td>
<%if (stock==0){%>
<input type="submit"
name="addCaddy<%=allData.get(i).getIdArticle() %>" value="Ajouter au panier" disabled="disabled"/>
<%}
else {%>
<input type="submit"
name="addCaddy<%=allData.get(i).getIdArticle() %>" value="Ajouter au panier" />
<%}%>
</td>
</tr>
<%}%>
</tbody>
</table>
</form> |
encore un grand merci pour votre aide