JSF is too sensitive to JavaBean naming
In order to function as a JavaBean class, an object class must obey certain conventions about method naming, construction, and behavior. These conventions make it possible to have tools that can use, reuse, replace, and connect JavaBeans.
The required conventions are:
- It has to have a no-argument constructor
- Its properties must be accessible using get, set and other methods (so called accessor methods) following a standard naming convention
- The class should be serializable (able to persistently save and restore its state)
- It should not contain any required event-handling methods
public class PersonBean implements java.io.Serializable {
private String name;
private boolean deceased;
// No-arg constructor (takes no arguments).
public PersonBean() {
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
// Different semantics for a boolean field (is vs. get)
public boolean isDeceased() {
return this.deceased;
}
public void setDeceased(boolean deceased) {
this.deceased = deceased;
}
}

0 Comments:
Post a Comment
<< Home