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
| <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test lecture table</title>
<link rel="stylesheet" href="css/style_2.css" type="text/css">
</head>
<body bgcolor="white">
<center><h1>Test lecture table</h1></center><br/>
Rechercher par CTRL+F<br/><br/>
<c:if test="${not empty pageContext.request.userPrincipal}">
User: <c:out value="${pageContext.request.userPrincipal.name}" />
</c:if>
<sql:query dataSource="jdbc/MYSQL" var="resultMYSQL">
SELECT COLONNE1, COLONNE2, COLONNE3, COLONNE4, COLONNE5
FROM `MATABLE` ORDER BY COLONNE1
</sql:query>
<p>Records : <c:out value="${resultMYSQL.rowCount}" /></p>
<table>
<tr>
<th>Colonne 1</th>
<th>Colonne 2</th>
<th>Colonne 3</th>
<th>Colonne 4</th>
<th>Colonne 5</th>
</tr>
<c:forEach var = "row" items = "${resultMYSQL.rows}">
<tr>
<td><c:out value = "${row.COLONNE1}"/></td>
<td><c:out value = "${row.COLONNE2}"/></td>
<td><c:out value = "${row.COLONNE3}"/></td>
<td><c:out value = "${row.COLONNE4}"/></td>
<td>
<c:set var = "longueur" value = "${fn:length(row.COLONNE5)}"/>
<c:if test = "${longueur==8}">
<c:out value = "${row.COLONNE5}"/>
<c:out value = "${fn:substring( row.COLONNE5, 0 ,4 )}"
</c:if>
</td>
</tr>
</c:forEach>
</table>
<br/><br/>
</body>
</html> |