javabean中boolean类型的处理

在EL表达式中获取一个JavaBean的boolean类型的属性的时候需要注意,优先使用isXxxx的方式获取

8.3.2 Boolean properties
In addition, for boolean properties, we allow a getter method to match the pattern:
public boolean is();
This “is” method may be provided instead of a “get” method,
or it may be provided in addition to a “get” method.
In either case, if the “is” method is present for a boolean property then we will
use the “is” method to read the property value.
An example boolean property might be:
public boolean isMarsupial();
public void setMarsupial(boolean m);

 

你可能感兴趣的:(J2EE,java)