Bonjour, je rencontre un problème avec une page JSP dans une application JEE par rapport au tag <c:forEach>.
Je travaille avec JSF 1.2 et RichFaces, et je veux créer dynamiquement des onglets dans une JSP. J'utilise un <c:forEach> qui boucle sur une ArrayList présente dans mon backingBean. J'utilise avec ce tag une EL type JSF qui donne l'erreur suivante:
Voici mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 #{..} is not allowed in template text
J'ai pourtant, il me semble, procédé comme sur un site dédié à RichFaces, la page dont je me suis inspiré est celle-ci:
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 <?xml version="1.0" encoding="ISO-8859-1" ?> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%-- JSF taglibs --%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@taglib uri="http://richfaces.org/rich" prefix="rich" %> <%@taglib uri="http://richfaces.org/a4j" prefix="a4j" %> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <link rel="stylesheet" type="text/css" href="./default/css/ownStyle.css" /> <title>Data Web Admin - Contents of the variables</title> </head> <body> <jsp:include page="./default/html/banner.html" /> <div class="contents"> <f:view> <div class="inside2"> Choose the contents of the variables to create the file <br /><br /> </div> <h:messages /> <h:form> <h:panelGrid> Periodicity of the data: <br /> <h:selectOneRadio id="list" value="#{dataBase.period}"> <f:selectItems value="#{dataBase.listPeriod}"/> </h:selectOneRadio> <br /> <h:commandLink action="#{dataBase.changeDisplay}" immediate="true"> <h:outputText value="Switch display"/> </h:commandLink> Contents: <br /> <h:dataTable value="#{dataBase.displayContentList}" var="displayCL" binding="#{dataBase.table}" styleClass="dataTableContents" rules="all" rendered="#{dataBase.bool2}"> <h:column> <rich:simpleTogglePanel switchType="client" label="Variable: #{dataBase.variableNames[dataBase.table.rowIndex]}" styleClass="togglePanel"> <h:selectManyListbox id="selecVariables" value="#{dataBase.listSelContMatrix[dataBase.table.rowIndex]}" size="#{dataBase.tableSize[dataBase.table.rowIndex]}"> <f:selectItems value="#{displayCL}" /> </h:selectManyListbox> </rich:simpleTogglePanel> </h:column> </h:dataTable> <!-- code qui pose problème --> <rich:tabPanel switchType="client" rendered="#{ dataBase.bool2}"> <c:forEach items="#{dataBase.displayContentList}" var="displayCL" varStatus="status"> <rich:tab label="Variable: "> <h:selectManyListbox id="selecVariables"> <f:selectItems value="#{dataBase.displayCubeNames}" /> </h:selectManyListbox> </rich:tab> </c:forEach> </rich:tabPanel> </h:panelGrid> <br /> <br /> <h:commandButton value="Download File" action="#{dataBase.validateContent}"></h:commandButton> </h:form> </f:view> </div> </body> </html>
http://blog.hibernate.org/11633.lace
Quand je remplace
par
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 "items="#{dataBase.displayContentList}""
là ça fonctionne, mais ce n'est pas beau, et après dans mon selectItem je ne peux pas récupérer l'élément numéro i de ma liste.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 "items="${dataBase.displayContentList}""
Si quelqu'un avait une idée sur la question, cela m'arrangerait grandement!
Merci!
Partager