Reputation: 23
in my jsf file i hava:
<f:facet > #{main.res['CORE_COMMON_LABEL_ACTIONS'] </f:facet>
and in back Bean i hava
public Map<String, String> getRes() {
return resourceBean.getResourcesMap(currentLocale);
}
that main.res['CORE_COMMON_LABLE_ACTION'] refer to getRes() and invok it.
WHAT is the []?can get value of hashMap with [] insteadof get()?
Upvotes: 2
Views: 5143
Reputation: 282
yes. you can get Map value with []. try something like this:
private Map<String, Object> objects = new HashMap<String, Object>();
public void add(String key, Object value) {
objects.put(key, value);
}
public Map<String, Object> getObjectsMap() {
return objects;
}
for example we have an entry :
add("hi" , "test");
then you can get value like this:
#{yourBean.objectsMap['hi']}
It will work;
Upvotes: 6