Ver Mensaje Individual
  #4 (permalink)  
Antiguo 12/07/2015, 04:51
Avatar de Profesor_Falken
Profesor_Falken
 
Fecha de Ingreso: agosto-2014
Ubicación: Mountain View
Mensajes: 1.323
Antigüedad: 10 años, 6 meses
Puntos: 182
Respuesta: Llamar metodos en JSF

Buenas,

Cuando desde la página haces Usuario.decirEdad como value del outputText, por detrás está utilizando Java reflection para encontrar la propiedad o accesor al dato expuesto por el bean. Para ello buscar los metodos que empiezan por get, is, etc o si Usuario es un mapa busca la propiedad en éste.

Por lo tanto, si quieres que el método sea accesible, lo más fácil es que lo llames, por ejemplo getDecirEdad y luego desde la página hagas Pagina.decirEdad.

Para más detalle echale un vistazo a este post sobre una consulta similar a la tuya:
http://www.coderanch.com/t/573634/JS...ean-method-JSF

Concretamente a este parrafo:
Cita:
The "value" attribute that appears on most of the JSF HTML data controls is NOT a method "call". It is a reference[/b] to a backing bean [i]property. A data value, not a function. According the the JavaBean convention, that means that there should be public "get" and "set" accessor methods defined in the backing bean ("set" is optional when you're using a display-only control such as outputText).
Un saludo
__________________
If to err is human, then programmers are the most human of us