Dear All,
When I am trying to call my service in my HTL like below then I am getting below error
org/apache/sling/scripting/sightly/apps/page/body_html.java:
Line 79, column 4095 : ai.core.service.OneTrustService cannot be resolved to a type
My Code is Below
Can anyone please help me here that why I am not getting the osgi config value in my HTL ?
Thanks
Lakhman
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @subnaik
To call an OSGi service from a Sling Model and use that Sling Model in HTL in AEM, follow these steps:
Create an OSGi Service:
Create a Sling Model:
@OSGiService
annotation.Use the Sling Model in HTL:
data-sly-use
directive.
Hi @subnaik
To call an OSGi service from a Sling Model and use that Sling Model in HTL in AEM, follow these steps:
Create an OSGi Service:
Create a Sling Model:
@OSGiService
annotation.Use the Sling Model in HTL:
data-sly-use
directive.
Is there a way that we can directly call the below value Onetrust Id and GTM Id directly in HTL ?
As Arun suggested, please inject your service in the sling model and get the values in HTL. If these values change based on the site then you can use context-aware configuration. Using ${caconfig['x.y.z.ConfigSample'].stringParam}, you can easily get the values in sightly without creating any helperModel. Refer https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configurati...
@subnaik Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies