c:choose / when / otherwise - ne fonctionne pas
Bonjour,
J'ai un cas qui parait tout simple, mai qui au final ne fonctionne pas :aie: .
J'ai un bean qui contient 2 champs, un seul de ces 2 champs peut être renseigné dans le bean.
Dans un tableau qui affiche ce bean, j'ai une colonne dans laquelle j'aimerais conditionner l'affichage de ces champs pour toujours afficher celui qui est renseigné :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
<p:dataTable id="identites"
value="#{gestionIdentitesForm.listIdentites}"
var="identite" widgetVar="identiteTable" filteredValue="#{gestionIdentitesForm.listIdentitesFiltered}"
emptyMessage="#{msg['AucuneIdentiteAAfficher']}"
sortMode="multiple"
rowKey="#{identite.id}" paginator="true" paginatorPosition="bottom"
rows="10" style="margin-bottom:10px"
paginatorTemplate=" {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10,30,50">
...
<p:column headerText="#{msg['Localite']}" style="width:10%">
<!-- Test pour savoir s'il faut afficher la localité préenregistrée ou la localité libre -->
<c:choose>
<c:when test="${not empty identite.adressePrincipale.localite.nom}">#{identite.adressePrincipale.localite}</c:when>
<c:when test="${not empty identite.adressePrincipale.localiteLibre}">#{identite.adressePrincipale.codePostalLibre} #{identite.adressePrincipale.localiteLibre}</c:when>
<c:otherwise>#{msg[AucuneLocaliteRenseignee]}</c:otherwise>
</c:choose>
</p:column>
...
</p:dataTable> |
Les champs du bean :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
// Localité préengistrée, en tant qu'objet
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private Localite localite;
// Code postal étranger, en saisie libre
@Column(name = "CODE_POSTAL_LIBRE", length = 100)
private String codePostalLibre;
// Localité étrangère, en saisie libre
@Column(name = "LOCALITE_LIBRE", length = 100)
private String localiteLibre; |
Le problème est que rien n'est affiché dans la colonne, ni même "Aucune localité renseignée" qui correspond au cas otherwise.
Qqun a-t-il une idée de ce qu'il me manque ?
Merci d'avance pour votre aide