Expand my Community achievements bar.

How to read value from Sling:OsgiConfig ??

Avatar

Former Community Member

I have created a node of type Sling:OsgiConfig and it has value in field property "loginurl" which is of string type. Now I have created a dialog box which needs to populate the value in "loginurl" to a text field in that dialog box. Any help to understand this situation or solution is much appreciated. 

4 Replies

Avatar

Level 10
  • Add a loadcontent listener on textfield which will send request to [1] and get the json response
  • Parse the response and use setValue() on textfield to put the required value

Sample config:

http://localhost:4502/apps/project/config/com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl.json

Avatar

Administrator

Hi

 

There is one good article apart from all above mentioned for your reference, covering creation of "sling:OsgiConfig" using different methods and reading properties of the same.

Link:- http://www.wemblog.com/2012/10/how-to-work-with-configurations-in-cq.html

 

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Employee Advisor

Hi,

If you have created a sling:osgiConfig node, you should have a service or component, which is using this configuration setting. Then this component/service should render the value.

Jörg