Assuming we have the following class
Normally we are accessing the properties in a bean from xhtml like syntax below.
But, recently found that we can actually accessing the properties of a bean like accessing a map.
in normally circumstances, it is nothing special from the traditional way.
But it is relatively useful if we want to dynamically access the properties in a bean.
Done!!
@ManagedBean(name="myBean")
public class MyBean {
private String property1;
private String property2;
// getter and setting for property1, property2, ...
}
Normally we are accessing the properties in a bean from xhtml like syntax below.
#{myBean.property1}
But, recently found that we can actually accessing the properties of a bean like accessing a map.
#{myBean['property1']}
#{myBean['property2']}
in normally circumstances, it is nothing special from the traditional way.
But it is relatively useful if we want to dynamically access the properties in a bean.
Done!!
No comments:
Post a Comment