FreeMarker Error : left-hand operand: Expected a hash, but this evaluated to a sequence
2017-03-07 14:44
9573 查看
FreeMarker
Error : left-hand operand: Expected a hash, but this evaluated to a sequence
AskQuestion
up vote2down votefavorite | When I loop through a list in freemarker like below, it works fine.<#list cModel.products as product> But when I'm tring to assign the size of 11ca5 the list to a variable like, <#assign totalProducts = cModel.products.getList()?size> I'm getting an exception from free marker like below left-hand operand: Expected a hash, but this evaluated to a sequence Any suggestions? freemarker
| ||||
a comment |
1 Answer
activeoldestvotesup vote5down voteaccepted | I Hope you've accessing it wrongly. As per your example, the list name is product. So, <#assign totalProducts = cModel.getProducts()?size> Should return back the size of the products. Hope it helps.
| ||||||||
|
相关文章推荐
- NonHashException left-hand operand: Expected a hash, but this has evaluated to a string//获取哈希对象异常
- 异常-----freemarker.template.TemplateException: Expected collection or sequence. datas evaluated instead to freemarker.core.HashLiteral$SequenceHash on line 7, column 18 in inc/select.ftl.
- expected number,sequence,or string.map evaluated instead of freemarker.template.smplehash
- Sunland is expected this month to the United States on specific issues
- is expected to be of type 'org.com.ssh.hibernate.AOPService.EchoTest' but was actually of type 'com.
- (莱昂氏unix源代码分析导读-34)You are not expected to understand this
- The goal you specified requires a project to execute but there is no POM in this directory
- Permission Denial: null asks to run as user 1771 but is calling from user 0; this requires android.p
- 【Visual Studio】The project appears to be under source control, but the associated source control plug-in is not installed on this computer
- This view is not constrained vertically: at runtime it will jump to the left unless you add a vertic
- [ERROR] Terminal initialization failed; falling back to unsupported java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
- an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe
- namenode启动报错:There appears to be a gap in the edit log. We expected txid 1, but got txid 16
- this kernel requires an x86-64 CPU, but only detected an i686 CPU. unable to boot - please ues a ker
- 错误:created a ThreadLocal with key of type ……but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
- asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_
- "WorldClient was expected to be running but wasn't;"解决方法
- this kernel requires an x86-64 CPU, but only detected an i686 CPU. unable to boot - please ues a ker
- appears to have started a thread named [startQuertz_xxx] but has failed to stop it. This is very...
- ValueError: Error when checking input: expected input_1 to have 2 dimensions, but got array with sha