我有以下案例:
Flex
上课
public class Flex {
private String key;
private String val;
public Flex () {
}
public void setKey(String key) {
this.key = key;
}
public String getKey() {
return key;
}
public void setVal(String val) {
this.val = val;
}
public String getVal() {
return val;
}
FlexManager
上课
public class FlexManager {
private Map<String, Flex> keyValue = new HashMap<String, Flex>();
public FlexManager () {
populateFlexFieldMap();
}
private void populateFlexFieldMap() {
if (keyValue.isEmpty()) {
List<Flex> fieldds = loadKVFromFile();
for (Flexfield : fieldds) {
keyValue.put(field.getKey(), field);
}
}
}
public void setKeyValue(Map<String, FlexField> keyValue) {
this.keyValue = keyValue;
}
public Map<String, Flex> getKeyValue() {
return keyValue;
}
}
使用managedBean的输入已准备就绪。
如何通过EL Flex
方法获取getKeyValue()
类中的val值?
我的方法是:${managedBeanName.keyValue['key'].val}
但我在IDE中收到此警告
未找到参考
${managedBeanName.keyValue['key'].val}
答案 0 :(得分:2)
您无需键入get
即可调用getter。
${managedBeanName.keyValue['key'].val}