java - Freemarker, Maps and Mongo. Getting a value out a nested structure -


i have mongo database , making small web application display values database. i'm having little problem getting value nested structure.

the database structure have is:

{       "_id": objectid("4e244ddcb1633b25c38f2155"),     "id": "2173",     "type": "p",     "title": "test title",      "tag": {       "0": {       "_id": objectid("4e244ddcb1633b25c38f1fc1"),       "name": "education",       "id": "6"  } }   } 

what is, database database , put in map , map put several other maps 1 map (root) , put .ftl page. can read value in .ftl like: ${root.title} ofcourse print 'test title' in above example.

i value of name in tage can print 'education'

i don't know how this. ideas.

you can access value using freemarker's built-in's hashes. similar below:

<#assign tagkeys = root.tag?keys> <#list tagkeys tagkey>     ${root.tag[tagkey].name} </#list> 

i have not tested yet speaking should work. might want read previous answers on so:

freemarker iterating on hashmap keys


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -