Hi,
Is it possible to call methods of WCMUsePojo class from Sling Model, I know it's not very good to use both sling model and WCMUsePojo class together, but we have a requirement where we have to reuse the method which is provided by third party & can not be refactored.
Thanks in advance.
Warm Regards,
Anupam Maiti
Solved! Go to Solution.
Hi Anupam,
As WCMPojo classes are not exported services, it wouldn’t be available to import and consume within sling models. You may want to do that in the front end using HTL.
WCMUsePojo / Sling Models are both ways from an HTL component to use Java logic. You use one way or the other.
You should pick either a Sling Model or WCMUsePojo and then code your Java logic so data is created and displayed in the HTL component.
WCMUsePojo:
Creating an Adobe Experience Manager 6.4 HTL component that uses the WCMUsePojo API
Sling Model:
Creating a custom Touch UI Grid Component for Adobe Experience Manager
NOTE - Most AEM Devs use Sling Models over WCMUSEPOJO
Hi Anupam,
As WCMPojo classes are not exported services, it wouldn’t be available to import and consume within sling models. You may want to do that in the front end using HTL.
you *can* instantiate the WCMUsePojo in your sling-models. Not very clean, but that is the only way I see.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies