If you want have access to the predefined variables like currentPage, currentNode, etc you need to add to the jsp
which have inside tag <cq:defineObjects /> which inizialize all predefined objects.
I have included global.jsp in my page and trying to use
currentNode Object and
Node node = resource.adaptTo(Node.class)
to access the node , but i am getting null .
With the currentPage Object i can access only those contents of type cq:page
But in this case i want to access content of type sling:folder
Hence i need currentNode object.Moreover in some default components like Flash this object is accessible , but in others like breadCrumb it is not accessible.
I want to kow the reason for the same.
CurrentNode implicit object return currentNode instance under which your script is running. Breadcrum are usually generated at run time using other resource path and may not belongs to current resource. In this case get path for that resource and adapt to Node Some thing like,
for all resource in breadcrum
Node eachNode = resourceResolver.getResource().adaptTo(Node.class)
Now you are in Node world