currentNode not available through cq:defineObjects | Community
Skip to main content
ajay_kumar_shar
January 19, 2016
Solved

currentNode not available through cq:defineObjects

  • January 19, 2016
  • 4 replies
  • 1206 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by edubey

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?

4 replies

edubey
Level 10
January 19, 2016

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

ajay_kumar_shar
January 19, 2016

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.

edubey
edubeyAccepted solution
Level 10
January 19, 2016

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?

ajay_kumar_shar
January 19, 2016

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.