This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
I am trying to get attribute value set in Slingmodel class. Below code is used to set value of attribute "mycustomparam" in sling model.
model1.java
request.setAttribute("mycustomparam", "value");
But unable to get this value in HTL
I have tried
${request.attribute @ mycustomparam}
In other model2.java, i am able to get this value using request.getAttribute('mycustomparam');
Is there any way to get value in sightly instead of model?
Views
Replies
Total Likes
Could you please check this https://www.linkedin.com/pulse/aem-63-request-attributes-ronak-bhayani/ if it helps.
Seems there isn't a way to directly access the request attributes in sightly and requires JS Use API. Here's a super short sample code to do just that: https://gist.github.com/gabrielwalt/a6a022ee65b3839d08bb4deb59211e57
@Nikhil_Verma yup there is no way to access request getattribute directly in sightly. We can use either js or separate model to get setted value.
@arunpatidar Use case is different. I need to set value in request parameterin model1.java andneed this value in different model model2, which si working fine in my implemenation.
Thanks
Heena
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies