Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

How to resolve pathfield of classic dialog that is used in jsp ?

Avatar

Level 3

How to resolve pathfield of classic dialog that is used in jsp ?

Can we use this in jsp?

request.getResourceResolver().map(
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You need .content.xml associated with /etc/map as well -

 

<?xml version="1.0" encoding="UTF-8"?>

-<jcr:root sling:internalRedirect="[/content/we-retail]" jcr:primaryType="sling:Mapping" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0">

<redirect/>

<reverse/>

</jcr:root>
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="sling:Mapping"
    sling:internalRedirect="[/content/we-retail/$1,/$1]"
    sling:match="(.+)$"/>
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="sling:Mapping"
    sling:internalRedirect="[/content/we-retail/(.*).html]"
    sling:match="$1/"/>

Please refer https://www.albinsblog.com/2018/04/how-to-implement-extension-less-urls-in-adobe-experience-manager.... for How to implement extension-less URL's in Adobe Experience Manager(AEM) implementation.

 

Hope this will help.

 

View solution in original post

5 Replies

Avatar

Community Advisor

could you please brief us about what are you trying achieve? Are you trying read author's entry through pathfield?

Avatar

Level 3

Hi @DEBAL_DAS 
Yes and also resolve the path so that it's shortened in live and .html is stripped off through jsp.

Avatar

Community Advisor

Here is the sample JSP code -

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

    String pagepath =  properties.get("rootPath", String.class);
    String mappath = null;

    if(pagepath!=null){
     mappath = slingRequest.getResourceResolver().map(pagepath);

}

  %><%=mappath%><%

%>

Author's entries via classic ui path field - /content/we-retail/language-masters/en/men/india-bangalore-aem.html

DEBAL_DAS_0-1653144892836.png

 

Rendered output has been show below (short and without .html extension) -

DEBAL_DAS_1-1653144973678.png

 

Avatar

Correct answer by
Community Advisor

You need .content.xml associated with /etc/map as well -

 

<?xml version="1.0" encoding="UTF-8"?>

-<jcr:root sling:internalRedirect="[/content/we-retail]" jcr:primaryType="sling:Mapping" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0">

<redirect/>

<reverse/>

</jcr:root>
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="sling:Mapping"
    sling:internalRedirect="[/content/we-retail/$1,/$1]"
    sling:match="(.+)$"/>
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="sling:Mapping"
    sling:internalRedirect="[/content/we-retail/(.*).html]"
    sling:match="$1/"/>

Please refer https://www.albinsblog.com/2018/04/how-to-implement-extension-less-urls-in-adobe-experience-manager.... for How to implement extension-less URL's in Adobe Experience Manager(AEM) implementation.

 

Hope this will help.