Reputation: 1590
Versions :
Aapche MyFaces 2.1.14
RichFaces 4.3.5
Issue :
I have a class implementing map interface like below :
public class FormStore implements Map {
private Map values;
public Object get(Object key) {
return values.get(key);
}
public Object put(Object key, Object value) {
return values.put(key, value);
}
}
I am using this map to store all submitted form values in my application and accessing in facelet as shown in below facelet code :
<h:inputText id="phone" value="#{formStore['phone']}" size="12" maxlength="20" required="true">
where formStore
is the java class above.
Now I have added another Map in above java class as below which serves some special purpose.
public class FormStore implements Map {
private Map values;
private Map additionalValues;
public Object get(Object key) {
return values.get(key);
}
public Object put(Object key, Object value) {
return values.put(key, value);
}
//getter and setter method for additionalValues also added
}
The issue is I am not able to access this new map from EL . I have tried following options :
1)<h:inputText id="phone" value="#{formStore.additionalValues['phone']}" size="12" maxlength="20" required="true">
2)<h:inputText id="phone" value="#{formStore.[additionalValues]['phone']}" size="12" maxlength="20" required="true">
3)<h:inputText id="phone" value="#{formStore[additionalValues]['phone']}" size="12" maxlength="20" required="true">
For every option , it calls FormStore.get method with key = additionalValues
Is it not possible to access the additionalValues map from FormStore.java
class ?
Please help.
Upvotes: 1
Views: 550
Reputation: 24423
This should work
<h:inputText id="phone" value="#{formStore.getAdditionalValues()['phone']}" size="12" maxlength="20" required="true">
Upvotes: 1