Invalid Reference Exception while accessing nested map in freemarker

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Invalid Reference Exception while accessing nested map in freemarker

Sushrut Bidwai
Hi,

I have nested map.

Map<String, Map<String, Long>> domains;

When I access it in following manner I get InvalidReferenceException

<#list somelist as item>
  <#list domains[item]?keys as key>
    ${key}
  </#list>
</#list>

Expression domains[item] is undefined on line...

I tried using BeansWrapper as well as DefaultObjectWrapper. Also I have checked contents on the map and none of the values are null.

Link to the same question on SO.


--
Best Regards,
Sushrut
http://simplycious.com

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|

Re: Invalid Reference Exception while accessing nested map in freemarker

Denis Bredelet
Hi Sushrut,

I have nested map.

Map<String, Map<String, Long>> domains;

How did you add it to the data root?


When I access it in following manner I get InvalidReferenceException

<#list somelist as item>
  <#list domains[item]?keys as key>
    ${key}
  </#list>
</#list>

Expression domains[item] is undefined on line...

I tried using BeansWrapper as well as DefaultObjectWrapper. Also I have checked contents on the map and none of the values are null.

Link to the same question on SO.


--
Best Regards,
Sushrut
http://simplycious.com
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|

Re: Invalid Reference Exception while accessing nested map in freemarker

Sushrut Bidwai
Hi Dennis,

Map root = new HashMap();
root.put("domains", domains);

On Sat, Mar 16, 2013 at 12:41 AM, Denis Bredelet <[hidden email]> wrote:
Hi Sushrut,

I have nested map.

Map<String, Map<String, Long>> domains;

How did you add it to the data root?


When I access it in following manner I get InvalidReferenceException

<#list somelist as item>
  <#list domains[item]?keys as key>
    ${key}
  </#list>
</#list>

Expression domains[item] is undefined on line...

I tried using BeansWrapper as well as DefaultObjectWrapper. Also I have checked contents on the map and none of the values are null.

Link to the same question on SO.


--
Best Regards,
Sushrut
http://simplycious.com
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user




--
Best Regards,
Sushrut

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|

Re: Invalid Reference Exception while accessing nested map in freemarker

Daniel Dekany
In reply to this post by Sushrut Bidwai
Works for me with both DefaultObjectWrapper and BeansWrapper, so I
guess somelist contains some bad keys. But see the same answer on SO
with test code:
http://stackoverflow.com/questions/15440026/invalid-reference-exception-while-accessing-nested-map-in-freemarker/15448101#15448101


Friday, March 15, 2013, 7:57:02 PM, Sushrut Bidwai wrote:

> Hi,
>
> I have nested map.
>
> Map<String, Map<String, Long>> domains;
>
> When I access it in following manner I get InvalidReferenceException
>
> <#list somelist as item>
>   <#list domains[item]?keys as key>
>     ${key}
>   </#list>
> </#list>
>
> Expression domains[item] is undefined on line...
>
> I tried using BeansWrapper as well as DefaultObjectWrapper. Also I
> have checked contents on the map and none of the values are null.
>
> Link to the same question on SO.
>
>
> --
> Best Regards,
> Sushrut
> http://simplycious.com 

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user