Citation:
<%@ include file="/WEB-INF/inc/top_header.jsp"%>
<img src="Image/banniere.jpg" width="1200" height="150" alt="">
<head>
<script type="text/javascript">
<!--
function client(e){
var url = "clients?op=check&id="+e.options[e.selectedIndex].value;
document.location.href = url;
}
//-->
</script>
</head>
<body bgcolor="#8FCF3C">
<div id="page"><%@ include file="/WEB-INF/inc/menu.jsp"%>
<div id="content">
<%@ include file="/WEB-INF/inc/header.jsp"%>
<div id="main">
<h1>Patient par Nom</h1>
<form action="<%= reqUrl %>/clients?" method="post">
<input type="hidden" name="op" value="check"/>
<p>
<label for="id">choisissez le Patient </label>
<select name="client_id" onchange="client(this)">
<option value=""></option>
<c:forEach var="client" items="${clients}" varStatus="status">
<option <c:if test="${client.id == param.id}">selected</c:if> value="${client.id}">${client.nom}-${client.prenom}</option>
</c:forEach>
</select>
</p>
</form>
</div>
<c:if test="${client!= null}">
<table id="liste_clients" class="tablesorter" cellspacing="1">
<thead>
<tr>
<th>Nom</th>
<th>Prénom</th>
<th>Adresse</th>
<th>Téléphone</th>
<th>Clinique</th>
<th>Chirurgien</th>
<th>Beneficiare</th>
<th>Date Operation</th>
<th>Date Accident</th>
<th>date de création</th>
<th>date de mise à jour</th>
<th>Opération
</th>
</tr>
</thead>
<tr>
<td>${client.nom}</td>
<td>${client.prenom}</td>
<td>${client.adresse}</td>
<td>${client.telephone}</td>
<td>${client.raison_sociale}</td>
<td>${client.nom_mededin}</td>
<td>${client.beneficiare}</td>
<td>${client.date_operation}</td>
<td>${client.date_accident}</td>
<td>${client.date_creation}</td>
<td>${client.date_mise_jour}</td>
<td><a href="clients?op=delete&id=${client.id}" onclick="if (window.confirm('Voulez-vous vraiment supprimer ce patient?'))
{location.href='index.jsp';return true;} else {return false;}">supprimer</a>
<a href="clients?op=edit&id=${client.id}">modifier</a></td>
</tr>
</table>
</c:if>
<h2>Liste de ses commandes</h2>
<table id="liste_commande" class="tablesorter" cellspacing="1">
<thead>
<tr>
<th>Référence commande</th>
<th>Objet</th>
<th>date de création</th>
<th>date de mise à jour</th>
</tr>
</thead>
<c:forEach var="Commande" items="${commandeClient}" varStatus="loopStatus">
<tr>
<td>${commande.nom}</td>
<td>${commande.prenom}</td>
<td>${commande.date_creation}</td>
<td>${commande.date_mise_jour}</td>
</tr>
</c:forEach>
</table>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#liste_produits").tablesorter();
});
</script>
</body>
<%@ include file="/WEB-INF/inc/footer.jsp"%>
et la servlet Clients
Citation:
if(action.equals("check")) {
Query q = sessionDb.createQuery("from Client C");
List<Client> clients = q.list() ;
request.setAttribute("clients", clients);
Integer id = null;
try {
id = Integer.parseInt(request.getParameter("id"));
}
catch (NumberFormatException e) {
// TODO: handle exception
}
if(id != null) {
String hql="select C.nom,C.prenom,C.raison_sociale,C.nom_mededin,C.date_operation,C.date_accident,cc.objet from Client C,CommandeClient cc where where C.id=cc.client.id";
Query q1= sessionDb.createQuery(hql);
q1.setInteger("id",id);
q1.list();
/* q = sessionDb.createQuery("from Client C where C.id =" + id);
Client client = (Client)q.uniqueResult() ;
request.setAttribute("client", client);*/
}
gotoPage("/jsp/clients/check.jsp", request, response);
}
merci de vos aide.