Expand my Community achievements bar.

SOLVED

Question on Selectors

Avatar

Level 1

In the CQ 5.5 component developer exam sample questions here http://training.adobe.com/certification/exams/cq-5.5-component-developer.html there is on

Given the following selector: print.a4 and the URL extension is html, which script will Sling render?
A. print.html.jsp
B. a4.html.jsp
C. print.a4.jsp
D. a4.jsp

Correct Answer: A

A similar question here http://dev.day.com/docs/v5_1/html-resources/cq5_guide_developer/ch02s08.html 

For example, consider a request to access the resource /content/corporate/jobs/developer.print.a4.html of type sling:resourceType="hr/jobs".

And the script selection order is

jobs.print.a4.esp
jobs.print.html.esp

which one is correct?

1 Accepted Solution

Avatar

Correct answer by
Level 8

The first example is the correct one, the second example is from version 5.1 and so is old and doesn't account for the latest updates to sling. Refer to these URLs for the latest Sling Script resolution logic:

I think the key point to remember is that if you want support multiple selectors driving script resolution you have to use sub-directories (print/a4.jsp) to have the second selector influence the script resolution. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 8

The first example is the correct one, the second example is from version 5.1 and so is old and doesn't account for the latest updates to sling. Refer to these URLs for the latest Sling Script resolution logic:

I think the key point to remember is that if you want support multiple selectors driving script resolution you have to use sub-directories (print/a4.jsp) to have the second selector influence the script resolution.