6 Replies Latest reply on Apr 16, 2018 8:02 AM by arjitbansal

    Sightly : How to Iterate through Map<String,Object>

    arjitbansal Level 1

      Hi ,

      I am not able to iterate the map in sightly. The map is having values as a bean object which i am not able to get in sightly.

      I am able to get the keys directly but for values i understood there has to be a second loop since it is an object .

      the code i have tried :

       

      <sly data-sly-use.model="package.Model"/>

      <sly data-sly-list.keyName="${model.map}">

      <li>keyname = ${keyName}</li>

      <li>keyvalue = ${model.map[keyName]}</li>

          <sly data-sly-list.key = "${model.map[keyName]}">

          BeanData= ${key}

                      <ol><li>${key.text}<li></ol><br/>

          </sly>

      </sly>

      Here in my code keyname is printed on the page but keyvalue is not.

      In java class the map is of type : map<String,Bean> and Bean class have the data members which i want to retrieve like text.

      Please guide where am I going wrong.

       

      I have already gone thru many links but couldn't find the solution.

      Links referred:

      Sightly : How to Iterate through Map<String  , Map>

      Iterating a map in sightly which have custom object as key

      How to traverse a Map having Keys of Object Type using Sightly ?