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
BedrockMission!

Learn More

View all

Sign in to view all badges

Sling Resource Resolution Preference

Avatar

Avatar
Validate 1
Level 1
saurabhp8517704
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
saurabhp8517704
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
saurabhp8517704
Level 1

08-09-2017

Hi all,

I've a base page component let's say homepage that contains 2 files. one is JSP, another html

sling-resolution.PNG

is referenced in homepage template. When I try to create a page using that template, it renders html files.

As far as I'm aware of, JSP takes preference over html so it should render JSP instead of html.

Please provide insight.

Regards,

Saurabh Pathak

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

449 likes

Total Posts

1,024 posts

Correct Reply

116 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

449 likes

Total Posts

1,024 posts

Correct Reply

116 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

09-09-2017

Hi Saurabh

      Sling Resolution is an important module in Sling. It is really important to understand the sling resolution before even starting AEM development. I have tried to explain the same here for a similar question here Template component can't override page.html . This explains how the files are resolved.

To answer your question simply,

     if the user request a content as --> <path>.<selector...>.<extension>

     then for the request resolution files ending with <selector>.<extension>.<script extension> takes priority

Always understand that selectors have maximum priority and the more selectors are matched the highest the priority. If selectors are not matched then the extension gets priority.

Here in your case sling priority looks like below

     1. homepage.html.jsp

     2. homepage.html

     3.homepage.jsp

     4.GET.html.jsp

     5.GET.html

     6.GET.jsp

This is best explained in [SLING-387] Simplify script paths and names - ASF JIRA . Please read and let me know if you have more questions. Adding below few more reads for you

Please read the URL decomposition under https://docs.adobe.com/docs/en/aem/6-3/develop/the-basics.html#URL Decomposition

From the above link

      Hope this helps you .

Thanks

Veena

Answers (4)

Answers (4)

Avatar

Avatar
Boost 1
Level 1
Gaurav_Tiwari_8
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
Gaurav_Tiwari_8
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
Gaurav_Tiwari_8
Level 1

04-12-2018

HTML will be preferred over JSP .(If they have same file name) Also extension should not be confused as while script selection Selcetor + extension will be the best match and it will be given priority .

So if you are trying localhost//resourcePath/selector1.selector2.extension.

Then Script precedence will be

1 - selector1/Slector2.extension

2 - selector1.extension

3- selector1.(HTML/JSP/ESP/JSON)

4- extension.(HTML/JSP/ESP/JSON)

5- NodeName.(HTML/JSP/ESP/JSON)

6- ResquestType(GET/HEAD).(HTML/JSP/ESP/JSON)

You can Watch This video and provide your valuable input Sling Script Resolution - YouTube

Avatar

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

158 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

158 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ratna_Kumar
MVP

10-09-2017

Hi Saurabh,

See this Adobe's Ask the Community Expert's session(ATCE) session by Lokesh about AEM and Sling.

It was beautifully explained there: ATACE May15 Sling

Hope this helps!

~Ratna.

Avatar

Avatar
Validate 1
Level 4
Diego_Fontan
Level 4

Likes

29 likes

Total Posts

62 posts

Correct Reply

12 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
Diego_Fontan
Level 4

Likes

29 likes

Total Posts

62 posts

Correct Reply

12 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Diego_Fontan
Level 4

08-09-2017

Between jsp and html first priority goes to jsp as by default a component is linked to jsp at the time of creation.

Here you can see a very clear explanation about sling resolution, selector, extension with examples.

http://www.aemcq5tutorials.com/tutorials/sling-resource-resolution-aem/

Avatar

Avatar
Validate 1
Level 4
BrijeshYadav
Level 4

Likes

57 likes

Total Posts

97 posts

Correct Reply

19 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Establish
View profile

Avatar
Validate 1
Level 4
BrijeshYadav
Level 4

Likes

57 likes

Total Posts

97 posts

Correct Reply

19 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Establish
View profile
BrijeshYadav
Level 4

08-09-2017

I think extension take precedence. So GET.html will execute