Can we add multiple selectors using Sightly? | Community
Skip to main content
October 16, 2015
Solved

Can we add multiple selectors using Sightly?

  • October 16, 2015
  • 4 replies
  • 2322 views

I am trying to add multiple selectors while using data-sly-resource. Code used ::

<div data-sly-resource="${currentPage.path @selectors=['form', 's1', 's2']}"></div>

It throws ClassCastException

java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.lang.String

Its working fine with single selector :: <div data-sly-resource="${currentPage.path @selectors='form'}"></div>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ove_Lindström

Have you tried

<div data-sly-resource="${currentPage.path @selectors='form.s1.s2'}"></div>

??

 

/Ove

4 replies

Ove_LindströmAccepted solution
Level 6
October 16, 2015

Have you tried

<div data-sly-resource="${currentPage.path @selectors='form.s1.s2'}"></div>

??

 

/Ove

October 16, 2015

This works but I need a combination of static and dynamic values.

October 16, 2015

Not sure if it matters, but the documentation shows a space between the '@' and the word 'selectors':

http://docs.adobe.com/content/docs/en/aem/6-0/develop/sightly.html

October 16, 2015

Space is not an issue. Tried it.