Templates 如何使用freemarker访问列表中对象的属性以及列表对象在hashmap中的属性?
我正在尝试访问对象的属性。但我很抱歉这个错误Templates 如何使用freemarker访问列表中对象的属性以及列表对象在hashmap中的属性?,templates,hashmap,javabeans,freemarker,Templates,Hashmap,Javabeans,Freemarker,我正在尝试访问对象的属性。但我很抱歉这个错误 FreeMarker template error: The following has evaluated to null or missing interestRate [in template "interestRate" at line 2, column 8] 在我的代码中,我创建了一个pojoclass对象列表,并用hasmap映射这个列表 List<InterestRateVO> list = new ArrayList
FreeMarker template error:
The following has evaluated to null or missing
interestRate [in template "interestRate" at line 2, column 8]
在我的代码中,我创建了一个pojoclass对象列表,并用hasmap映射这个列表
List<InterestRateVO> list = new ArrayList<InterestRateVO>();
Map<String,List<InterestRateVO>> interestRate = new HashMap<String,List<InterestRateVO>> ();
list.add(interestRateVO);
interestRate.put(tableData[1],list);
这是我的小姑娘
public class InterestRateVO {
private String currency;
private String rate;
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
}
我用的是这个代码
<#list interestRate?keys as inter>
${inter} = ${interestRate[inter].currency}
</#list>
你把兴趣图本身放在数据模型的什么地方。模板上下文?是否向视图发送interestRate?
<#list interestRate?keys as inter>
${inter} = ${interestRate[inter].currency}
</#list>