Hi,
Scenario:
(AEM 6.3.2) I'm requesting a page with the selector "test1", like this: http://localhost:4502/content/myapp/home.test1.html
This page have a parsys where I have drop a component "slider", so the component's path is: "/content/myapp/home/jcr:content/parsys/slider"
At the "slider" component level, how can I access to the "test1" selector?
I've tried different ways (SlingModel, WCMUsePojo, the "request" HTL Global Object...), but always get the same problem: the "request" I can access is the GET request of the component (GET "/content/myapp/home/jcr:content/parsys/slider.html") where the selector is not present.
I need to use that selector in a WCMUsePojo, so any HTL/Java solution will be appreciated.
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
I tried this line in one of core components. The request path you have shared is the resourcePath
selectors --> ${request.requestPathInfo.selectors} <--
Views
Replies
Total Likes
Try this -
Set the selector in request attribute or request parameter before you can access it in WCMUsePojo's activate()
your component (HTL/jsp) can access the selector from slingrequest something like slingHttpServletRequest.getRequestPathInfo().getSelectors()
then do setAttribute(..) or setParameter(..) and get that in Pojo.
Views
Replies
Total Likes
The problem is that when I try to access to the selector from the component's HTL, I can not see it because it's not present in the component's request.
For example, if I set this in my components HTL:
<p>Here should be a selector: -${request.requestPathInfo.selectorString}- or maybe here: -${request.requestPathInfo.selectors[0]}-, but doesn't work because the request path is: ${request.requestPathInfo.resourcePath}</p>
The output is:
<p>Here should be a selector: -- or maybe here: --, but doesn't work because the request path is: /content/myapp/home/jcr:content/parsys/slider</p>
Views
Replies
Total Likes
I tried this line in one of core components. The request path you have shared is the resourcePath
selectors --> ${request.requestPathInfo.selectors} <--
Views
Replies
Total Likes
Nevermind, just checked the same HTL in another AEM instance with the same version and it's working... I will check what is causing the wrong behavior in the old instance. Thanks!!
Views
Replies
Total Likes
Views
Likes
Replies