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

SOLVED

How to get page selectors from experience fragment.

Avatar

Level 2

I have this configuration.  (Experience fragments are dragged and dropped  and configured)

Page -> Xf1 ->XF2 -> componentA.

 

I need to get the selectors in compenentA from the page URL path. (/content/site/page.selector.html)

Issue: ComponentA is trying to find the selectors in the XF2  path. (/content/experiencefragemt/XF2.html)

Please let me know if this can be done.

I am using this code for getting the selectors.

request.requestPathInfo.selectors

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @sharathn8223803, could you please try below code. I think it should solve your problem.

import com.day.cq.commons.PathInfo;
// your Sling model implementation
// ....

PathInfo pathInfo = new PathInfo(request.getPathInfo());
pathInfo.getSelectors();

In general I did quick test and I was able to get list of selectors from page url on component level that was placed in XF.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @sharathn8223803, could you please try below code. I think it should solve your problem.

import com.day.cq.commons.PathInfo;
// your Sling model implementation
// ....

PathInfo pathInfo = new PathInfo(request.getPathInfo());
pathInfo.getSelectors();

In general I did quick test and I was able to get list of selectors from page url on component level that was placed in XF.