Bonjour,
j'arrive pas à comprendre le fonctionnement d'une vue xhtml dans un projet développé avec le framework JSF.
voilà le bout de code simplifié
ManagedBean:
la vue
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 @ManagedBean @SessionScoped public class BeanManage{ private List<Personne> personnes; //getters and setters }
ce que je ne comprend pas est ce qu'on a la possibilité de passer dans l'attribut value du composant dataTable un bean au lieu d'une liste?
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 </html><?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" > <h:body> <p:dataTable var="element" value="#{beanManage}"> <p:column headerText="nom"> <h:outputText value="#{element.nom}"></h:outputText> </p:column> <p:column headerText="prénom"> <h:outputText value="#{element.prenom}"></h:outputText> </p:column> </p:dataTable> </h:body> </html>
Merci de votre réponse
Partager