Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Is it possible to call methods of WCMUsePojo class from Sling Model ?

Anupam_Maiti
Level 2
Level 2

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

1 Accepted Solution
Lokesh_Shivalingaiah
Correct answer by
Community Advisor
Community Advisor

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.

View solution in original post

0 Replies
smacdonald2008
Level 10
Level 10

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

Lokesh_Shivalingaiah
Correct answer by
Community Advisor
Community Advisor

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.

Feike_Visser1
Employee
Employee

you *can* instantiate the WCMUsePojo in your sling-models. Not very clean, but that is the only way I see.