Désactiver un lien (condition)
salut
j'aimerais activer et desactiver un lien " href " en fonction d'une condition ( par rapport a un champs dans mon tableau )
voici le code de ma page JSP:
elle contient un tableau --> une liste des commandes
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
| <%@ 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="commandeExpedService" class="com.project.service.CommandeExpedService"></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>liste des commandes</title>
<link type="text/css" rel="stylesheet" href="<c:url value="/css/style.css"/>" />
</head>
<body>
<c:import url="/menuExped.jsp" />
<div id="corps">
<fieldset>
<legend>Liste des commandes</legend>
<c:choose>
<%-- Si aucune commande n'existe dans la BD, affichage d'un message par défaut. --%>
<c:when test="${ empty commandeExpedService.findAll() }">
<p class="erreur">Aucune commande enregistrée.</p>
</c:when>
<%-- Sinon, affichage du tableau. --%>
<c:otherwise>
<table>
<tr>
<th>Client</th>
<th>Produit</th>
<th>Quantite</th>
<th>Montant</th>
<th>Date de commande</th>
<th>Date de livraison</th>
<th>Statut de livraison</th>
<th>Etat</th>
<th class="action">Modifier</th>
<th class="action">Supprimer</th>
</tr>
<%-- Parcours de la liste des commandes en BD, et utilisation de l'objet varStatus. --%>
<c:forEach items="${ commandeExpedService.findAll() }" var="commandesExped" 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 commandesExped, qui est stocké en BD --%>
<td><c:out value="${commandesExped.client.nom } ${ commandesExped.client.prenom}" /></td>
<td><c:out value="${commandesExped.produit.description}" /></td>
<td><c:out value="${commandesExped.quantite}" /></td>
<td><c:out value="${commandesExped.montant}" /></td>
<td><c:out value="${commandesExped.date }" /></td>
<td><c:out value="${commandesExped.dateExped }" /></td>
<td><c:out value="${commandesExped.priseEnChargeLiv }" /></td>
<td><c:out value="${commandesExped.etat }" /></td>
<%-- Lien vers la servlet de suppression et modification, avec passage de l'id de la commande en paramètre--%>
<td class="action"> <a href="<c:url value="/modifierCommandeExped.jsp"> <c:param name="idCommandeMod" value="${commandesExped.idCommande }" /> </c:url>">
<img src="<c:url value="/images/edit.png"/>" alt="Modifier" />
</a></td>
<td class="action"> <a href="<c:url value="/suppressionCommande"> <c:param name="idCommandeSup" value="${commandesExped.idCommande }" /> </c:url>">
<img src="<c:url value="/images/supprimer.png"/>" alt="Supprimer" />
</a></td>
</tr>
</c:forEach>
</table>
</c:otherwise>
</c:choose>
</fieldset>
</div>
</body>
</html> |
j'aimerais desactiver ce link :
Code:
1 2 3
| <td class="action"> <a href="<c:url value="/modifierCommandeExped.jsp"> <c:param name="idCommandeMod" value="${commandesExped.idCommande }" /> </c:url>">
<img src="<c:url value="/images/edit.png"/>" alt="Modifier" />
</a></td> |
si le contenu de ce champ est different de la valeur="En attente"
Code:
<td><c:out value="${commandesExped.etat }" /></td>
merci de votre aide