AEM: getting states matching country from another node

久未见 提交于 2020-01-06 02:51:18

问题


I have the following design issue:

  1. I am reading a node which has country and states using which I could create a new json structure of country states.

  2. Using this json structure in point 1, I have consumed country using my country component as a dropdown. Using each country in a drop down in the country component, I can create different selections of countries by dragging multiple instance of country component. I can pull a default sling servlet by calling this authored page by appending .infinity.json which will give me list of countries that was authored using this country component.

  3. Now, I am creating another servlet which reads the above infinity.json page in point 2, how can I refine it further to add states of those countries which I initially read in point 1 and populated in the new JSON structure.

Here is what I have done so far:

in the servlet mentioned in point 1, the following will create a country and state mapping:

MultiMap multi = new MultiMap(); //this has setters and getters
multiMap.put(country.toUpperCase(), state);
LOG.info(this.getMultiMap().entrySet(); //looks good

Here is the issue: in the servlet mentioned in the point 3, I am trying getting the country-states mapping from above multimap but it is null.

MultiMap map = countryStateServlet.getMultiMap(); //this is null

what am I doing wrong ?

It seems to be an inter object communication issue because resource from I/O are read during runtime only(if I am correct). Need some pointers how to proceed further.

来源:https://stackoverflow.com/questions/35685126/aem-getting-states-matching-country-from-another-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!