Get Hash Value with two methods.But the one works finely, the other one is Exception.
Gerry Chen <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Everyone!
I had a question about geting a hash value,When I used the my directives.
My method like this:
package com.star.yxt.common.model;
import ......;
public class PageSizeModel implements TemplateMethodModel {
private Map<String,Integer> mapPageSize = new HashMap<String,Integer>;
@Override
public Object exec(List args) throws TemplateModelException {
..............
return mapPageSize;
}
}
My FLT template like this:
<#macro drp_pagesize selectname modelname selected>
<#assign tmpmodename=
(modelname!"com.star.yxt.common.model.PageSizeModel")?new()>
<select name="${selectname}" class="input">
<#if tmpmodename??>
<#assign keys=tmpmodename()?keys>
<#list keys as key>
${tmpmodename().["$key"]} <#-- It
does wok finely -->
${tmpmodename().key} <#-- It doesn't work finely -->
.........
I have saw the tutorial in FreeMarker websit.The tutorial indicate that
book["title"] equal book.title in the
templates.(http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_var_hash).
My question is why the expression ${tmpmodename().key} can't work.
Who can explain my puzzledom about this situation?
Thanks!
--
View this message in context: http://www.nabble.com/Get-Hash-Value-with-two-methods.But-the-one-works-finely%2Cthe-other-one-is-Exception.-tp21111115p21111115.html
Sent from the freemarker-user mailing list archive at Nabble.com.
------------------------------------------------------------------------------