Bonjour à toute la communauté,

je bloque sur une bétise, auriez-vous l'amabilité de m'éclairer !

Je veux afficher le contenu d'une table mysql en utilisant jstl sql.
Si j'affiche la table telle qu'elle, aucun problème, mais j'aimerais faire un test sur le contenu du champ... mais apparemment la fonction que j'utilise n'est pas la bonne !

Mon but : un champcontient une date sous forme ddMMyyyy (12062018) ou dMMyyyy (1062018) et j'aimerais l'afficher sous format 12/06/2018 ou 01/06/2018

Voici un essai de code qui ne fontionne pas !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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>
Pouvez-vous m'aider ?
Merci d'avance pour vos réponses :-))