Skip to main content
codingStar
Level 3
Nov 8, 2016 10:14 AM UTC
Solved

How get page url with Query parameter in sightly


my page url in browser shows as 
http://localhost:4502/content/mywebsite/mypage.html?query1=param1&query2=param2

In my viewhelper When i user
1- getRequest().getRequestURL()  return http://localhost:4502/content/mywebsite/mypage.html
2- getRequest().getQueryString() return query1=param1&query2=param2

How i can get url with Query in viewhelper class
eg:-http://localhost:4502/content/mywebsite/mypage.html?query1=param1&query2=param2

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Feike_Visser1
Feike_Visser1Accepted solution
Adobe Employee
Nov 10, 2016 9:21 AM UTC

Via getRequest() you access all properties from SlingHttpServletRequest.

4 replies

Feike_Visser1
Adobe Employee
Adobe Employee
Nov 8, 2016 11:44 AM UTC

${request.requestParameterMap['query1'][0].toString}

Translate
codingStar
Level 3
Nov 10, 2016 7:31 AM UTC

Hi Feike,

How can i get full URL in component viewHelper?

like http://localhost:4502/content/mywebsite/mypage.html?query1=param1&query2=param2

Translate
Feike_Visser1
Adobe Employee
Feike_Visser1Adobe EmployeeAccepted solution
Adobe Employee
Nov 10, 2016 9:21 AM UTC

Via getRequest() you access all properties from SlingHttpServletRequest.

Translate