tags:

views:

28

answers:

1

I have something like that:

faces-config.xml

<managed-bean>
  <managed-bean-name>aBean</managed-bean-name>
  <managed-bean-class>some.pack.Bean</managed-bean-class>
  <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

I have a bean and in jsp page I have something like value="#{aBean.someBoo}". But I dont have such property in bean's java file. There is no such thing as for example: private String someBoo; Instead there is getSomeBoo() method. The code works but I can't understand why. How does it know to execute getSomeBoo() if there is only #{aBean.someBoo}. Is it some convention that it omits get? What am I missing? I quite newbie so where I can find it explained well.

+2  A: 

The code will assume your aBean follows the JavaBeans convention, that is a property is defined by its getter and setter. The getters and setters respectively are of the form PropertyType get<PropertyName>() and void set<PropertyName>(PropertyType). Note the name of the property begins with a capital letter in the getter and setter methods, while the bean property's name begins with a lower case letter.

Romain
Is there any more 'conventions'? Where I can learn about this?
l245c4l
You'd find all about those in the API specification on java.sun.com ... For what concerns JSF beans, I think that's quite all you need to know.
Romain