Map problem when passing it as model to view in grails

Posted by xain on Stack Overflow See other posts from Stack Overflow or by xain
Published on 2010-03-27T00:13:12Z Indexed on 2010/03/27 0:23 UTC
Read the original article Hit count: 603

Filed under:
|
|
|

Hi, In a controller, I have populated a map that has a string as key and a list as value; in the gsp, I try to show them like this:

<g:each in="${sector}" var="entry" >
  <br/>${entry.key}<br/>
  <g:each in="${entry.value}" var="item" >
    ${item.name}<br/>
  </g:each>
</g:each>

The problem is that item is considered as string, so I get the exception

Error 500: Error evaluating expression [item.name] on line [11]:
groovy.lang.MissingPropertyException: No such property: nombre for class: 
java.lang.String

Any hints on how to fix it other than doing the find for the item explicitly in the gsp ?

© Stack Overflow or respective owner

Related posts about grails

Related posts about map