내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

How can I invoke WCMuse java class from JAVASCRIPT Use api

Avatar

Level 1

I have a wcmuse class which works fine with data-sly-use.
Now I want to invoke this class and its methods from Sightly Javascript-use api.

I want to do some extra work hence i need to have data-sly-use functionality in javascript.

Please help.

When I try this code in JS its getting instantiated but the activate method is not invoked :

use(function () {

    var articleList = new Packages.com.xxx.cq.unifiedweb.core.sightly.DocumentationPageHelper;

    var list = articleList.getRecommendedList();

    // you can reference the parameters via the this keyword.

    var retValue = this.value1 + this.seperator + this.value2;

    return {

        newValue: retValue

    };

});

Java class :

public class DocumentationPageHelper extends WCMUse {

@Override

public void activate() throws Exception {

SlingScriptHelper slingScriptHelper = getSlingScriptHelper();

/** Do something **/

}

}

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Level 10

Answer is no - if you want to use WCMUse API - you call it from HTL code.

Here is breakdown of HTL Articles

1 - show how to work with WCMUsePojo - Creating an Adobe Experience Manager 6.4 HTL component that uses the WCMUsePojo API

2 - how to work with HTL and Sling Models - Creating a custom Touch UI Grid Component for Adobe Experience Manager

3 - how to use JS API - Creating a Tab layout component for Adobe Experience Manager

Typically - you pick one of these methods - you cannot mix them.

원본 게시물의 솔루션 보기

3 답변 개

Avatar

Level 10

Hi,

I think you cannot invoke in that way as per my knowledge i.e., Java Use API in JS Use API..

You can invoke Java use API and JS use API in HTL file only.

Thanks,

Ratna Kumar.

Avatar

Level 1

Thanks for your reply but I am using the JS use API in HTL only.

I just want to know if we can call the custom WCMuse class from JS use API?

Avatar

정확한 답변 작성자:
Level 10

Answer is no - if you want to use WCMUse API - you call it from HTL code.

Here is breakdown of HTL Articles

1 - show how to work with WCMUsePojo - Creating an Adobe Experience Manager 6.4 HTL component that uses the WCMUsePojo API

2 - how to work with HTL and Sling Models - Creating a custom Touch UI Grid Component for Adobe Experience Manager

3 - how to use JS API - Creating a Tab layout component for Adobe Experience Manager

Typically - you pick one of these methods - you cannot mix them.