can get value of hashMap with [] in jsf?

jsf

Solution

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;

Problem

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()?

Original source