How do I access a request query string parameter in Sightly HTML. Do I have to expose it through the WCMUse model or can I just access it directly in the HTML?
Solved! Go to Solution.
Views
Replies
Total Likes
You can use the following:
${request.requestParameterMap['test'][0].toString}
With http://server:port/resource?test=hello, then the output is ‘hello’
See this Blog that talks about Sightly:
http://blogs.adobe.com/experiencedelivers/experience-management/sightly-intro-part-4/
This talks about how to access the parameters.
Views
Replies
Total Likes
These are request attributes, not query string attributes e.g. getParameter. How do I get a query string parameter e.g. ?query=some+query
Views
Replies
Total Likes
Once you have the SlingHttpRequest object you can get the parameters using request.getParameter method.
Have you tried that?
Views
Replies
Total Likes
You can use the following:
${request.requestParameterMap['test'][0].toString}
With http://server:port/resource?test=hello, then the output is ‘hello’
Please note that there is an issue with this since AEM6.3+SP1+CFP1 (AEM6.3.1.1)
Workaround here: htl-examples/request-parameter.html at master · heervisscher/htl-examples · GitHub
Views
Replies
Total Likes
Try this:
${request.parameterMap.test}
Views
Replies
Total Likes
Views
Replies
Total Likes
Is it possible to return all the query string parameters? Similar to javascript window.location.search. Eg: current page url is https://google.com?utm_source=search&utm_media=online¶m3=xxx and the expected return string is ?utm_source=search&utm_media=online¶m3=xxx
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies