Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

currentNode not available through cq:defineObjects

Avatar

Level 1

Hi All,

  I have set up the aem project in IDE. However, i am not getting the autocomplete option for "currentNode" object. Problem is that project will not build because of compilation error. Can you please help.

Thanks

Ajay

1 Accepted Solution

Avatar

Correct answer by
Level 10

IDE will not be able to recognize the auto completion of currentNode, and in order to test and execute your code you need to deploy it in AEM.

You cannot compile and execute from IDE

You should edit in JSP crxde and then using vault eclipse plugin get the code in IDE.

Which IDE you are using?

View solution in original post

4 Replies

Avatar

Level 10

Cq: Define Object does not gives the access to currentNode

Its the part of JCR API [1]

https://docs.adobe.com/docs/en/cq/5-6-1/developing/the_basics.html#Development Objects in the WEM Environment

Avatar

Level 1

edubey wrote...

Cq: Define Object does not gives the access to currentNode

Its the part of JCR API [1]

https://docs.adobe.com/docs/en/cq/5-6-1/developing/the_basics.html#Development Objects in the WEM Environment

 

Thanks for the response. I have checked the links provided. Can you please provide more details. 

Please find my detailed insight below:
  - The <cq:defineObjects> tag exposes the following, regularly used, scripting objects which can be referenced by the developer. It also exposes the objects defined by the <sling:defineObjects> tag.
    - currentNode is one of the objects exposed by <sling:defineObjects>.
    - Ref: https://docs.adobe.com/docs/en/cq/5-6-1/developing/components.html#<cq:defineObjects>
    - Ref: https://docs.adobe.com/docs/en/aem/6-0/develop/components.html#Function of global.jsp, used APIs and Taglibs

  - Also, if you directly edit jsp in crx-de and input below code, it works:
    - String pageTitle = currentNode.getProperty("jcr:title").getString();
    - This implies that this object is exposed but IDE is not able to recognize it.

  - Only problem is making this compile from IDE. Because of which bundle will not be deployed.

Avatar

Correct answer by
Level 10

IDE will not be able to recognize the auto completion of currentNode, and in order to test and execute your code you need to deploy it in AEM.

You cannot compile and execute from IDE

You should edit in JSP crxde and then using vault eclipse plugin get the code in IDE.

Which IDE you are using?

Avatar

Level 1

Hi

edubey wrote...

IDE will not be able to recognize the auto completion of currentNode, and in order to test and execute your code you need to deploy it in AEM.

You cannot compile and execute from IDE

You should edit in JSP crxde and then using vault eclipse plugin get the code in IDE.

Which IDE you are using?

 

 

Hi Praveen,

  I had done it that way. Wanted to see if anyone has resolved it.

  I am using Intellij.