I have a container component in container.jsp I want to include another component (Tile component) .Tile component has got 2 jsps,
In container.jsp when condition A matches I want to include Tile component only tile.jsp executed.
When condition B matches I want to include tile component only tile.selector.jsp to render content.
I tried with <cq:include resourceType="/apps/gwc/components/content/resTile" path ="abc.selector" />
and <sling:include resourceType="/apps/gwc/components/content/resTile" path="abc" addSelectors="selector" />
Both dont work, every time I get tile.jsp rendered.
Thanks in advance.
Any help would be appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
Got it working by doing the below mentioned.
The <cq:include> requires the path to actually exists in first place , does not craete a node with teh "path" under current content hierarchy, sling:include does that .
Below is the include statement that worked for me.
<sling:include resourceType="/apps/myapp/components/content/resTile" path="resTile_${count}" addSelectors="story" />
Views
Replies
Total Likes
@Asn_177,
This is what sling document provide.
https://sling.apache.org/documentation/bundles/scripting/scripting-jsp.html#include
asn_177 wrote...
I have a container component in container.jsp I want to include another component (Tile component) .Tile component has got 2 jsps,
In container.jsp when condition A matches I want to include Tile component only tile.jsp executed.
When condition B matches I want to include tile component only tile.selector.jsp to render content.
I tried with <cq:include resourceType="/apps/gwc/components/content/resTile" path ="abc.selector" />
and <sling:include resourceType="/apps/gwc/components/content/resTile" path="abc" addSelectors="selector" />
Both dont work, every time I get tile.jsp rendered.
Thanks in advance.
Any help would be appreciated.
Views
Replies
Total Likes
@Ann_177,
Just a thought.Have not tried but one way to soleve is to rely on path attribute in sling include rather than resourceType. Let's suppose you have component BOX, you want to include FEED component with multiple selectors then put the relative path with selectors.
for instance,
<sling:include path="/par/feed" addSelectors="json"/>
<sling:include path="/par/feed" addSelectors="xml"/>
Views
Replies
Total Likes
Hi
You could use sling:include tag, which provides attributes to modify the selectors & suffix on the request:
<sling:include resourceType="myComponent" path="my/path" addSelectors="altView"/>
or
<sling:include resourceType="myComponent" path="my/path" replaceSelectors="altView"/>
I hope this helps.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Documentation Link:-https://docs.adobe.com/docs/en/cq/5-6-1/developing/components.html
~kautuk
Views
Replies
Total Likes
Got it working by doing the below mentioned.
The <cq:include> requires the path to actually exists in first place , does not craete a node with teh "path" under current content hierarchy, sling:include does that .
Below is the include statement that worked for me.
<sling:include resourceType="/apps/myapp/components/content/resTile" path="resTile_${count}" addSelectors="story" />
Views
Replies
Total Likes