Bonjour,
Tout est dans le titre. Je veux faire un truc de ce genre :
Classe contenant ma variable statique :
Accès à ma variable dans la page test.xhtml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part 
2
3
Certains proposent de passer par des getters dans le bean et d'y retourner la variable statique mais y a-t-il que ça comme solution ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part 
2
3
4
5
6
7
8
9
10
11
12
13
14<?xml version="1.0" encoding="UTF-8" ?> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> ... <h:outputText value="#{MesConstantes.MA_VARIABLE}" /> ... </ui:composition>
Solution avec getter :
Code : Sélectionner tout - Visualiser dans une fenêtre à part 
2
3
4
5
6
7
8
9
Code : Sélectionner tout - Visualiser dans une fenêtre à part 
2
3
4
5
6
7
8
9
10
11
12
13
14<?xml version="1.0" encoding="UTF-8" ?> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> ... <h:outputText value="#{monBean.var}" /> ... </ui:composition>

 

 
		
		 
        

 
			
			



 Accès aux variables statiques dans une page JSF / XHTML
 Accès aux variables statiques dans une page JSF / XHTML
				 Répondre avec citation
  Répondre avec citation

 
  
  
 
 
			 
   
 
 Envoyé par romaintaz
 Envoyé par romaintaz
					
 !
 ! 
						
Partager