Expand my Community achievements bar.

SOLVED

How get page url with Query parameter in sightly

Avatar

Level 4


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

1 Accepted Solution

Avatar

Correct answer by
Employee

Via getRequest() you access all properties from SlingHttpServletRequest.

View solution in original post

4 Replies

Avatar

Employee

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

Avatar

Level 4

Hi Feike,

How can i get full URL in component viewHelper?

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

Avatar

Correct answer by
Employee

Via getRequest() you access all properties from SlingHttpServletRequest.