Expand my Community achievements bar.

access global object in Use class

Avatar

Level 4

Hi

How can i access global Java-backed Objects mentioned in https://docs.adobe.com/docs/en/htl/docs/global-objects.html in a Java class that extends WCMUsePojo.

Thank you

6 Replies

Avatar

Level 10

You can directly invoke these method in the class which extends WCMUsePojo.

Check this documentation https://docs.adobe.com/docs/en/htl/docs/use-api/java.html

Avatar

Level 4

am looking to retrieve java-backed objects mentioned in https://docs.adobe.com/docs/en/htl/docs/global-objects.html . getProperties(), getCurrentPage() methods are available as part of WCMUseOPojo. looking to retrieve other objects (mentioned with variable names in the documentation) like componentContext, log, out, reader, resource etc

Avatar

Employee

They should be already there, otherwise you can use the following:

 ComponentContext context = get("componentContext", ComponentContext.class);

Avatar

Level 4

am looking to retrieve java-backed objects mentioned in https://docs.adobe.com/docs/en/htl/docs/global-objects.html . getProperties(), getCurrentPage() methods are available as part of WCMUseOPojo. looking to retrieve other objects (mentioned with variable names in the documentation) like componentContext, log, out, reader, resource etc

Avatar

Level 10

If you want access to those Global objects - you do not need to use Java - you can access directly from HTML. 

https://docs.adobe.com/docs/en/htl/docs/global-objects.html

Hope this helps.