Hi All,
is there a way to adapt a resource to custom model class in sightly?
I have a custom model and i want to adapt a resource to it in sightly html code not in java.
Thanks,
Khalid
Solved! Go to Solution.
Sure this is possible. By default classes used in data-sly-use will be adapted from request or resource.
Sure this is possible. By default classes used in data-sly-use will be adapted from request or resource.
Thanks Feike,
Any code snippet or sample?
Views
Replies
Total Likes
<div data-sly-use.x="a.b.c">
${x.yourProperty}
</div>
A function is returning me an object which is of type "Resource", i want to cast it to my model class.
like we do in java : Model model=resource.adaptTo(Model.class);
Something similar to this.
Views
Replies
Total Likes
Note that currently the page-resource is used for adapting.
I raised this improvement [SLING-6504] Use-api to support more flexible way to adapt from different objects - ASF JIRA
Hi Feike,
I am a bit confused with this.
Can you provide me a snippet only instead of JIRA issue?
Views
Replies
Total Likes
I gave you the snippet already, right?
The JIRA is not yet released.
Views
Replies
Total Likes
Views
Likes
Replies