May 10, 2020
Estimated Post Reading Time ~

How to get current page path in AEM

How to get the current page path in AEM.
In AEM all the data are stored in the form of nodes.
Sometimes it becomes important to get the path of the page node for performing various operations like storing data under the page node.

This can easily be done from a component JSP file by using the implicit "currentPage" object as shown below.

<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" %>

    <%
        out.println(currentPage.getPath());
    %>

Drag and drop this component to an authorable page. This will print the current page path in the rendered HTML page.
getting%2Bthe%2Bpage%2Bpath%2Bin%2BAEM_codermag.net



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.