问题
I have the following design issue:
I am reading a node which has country and states using which I could create a new json structure of country states.
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.
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