My application allows user to change language in any given moment and that cause me some trouble. For example if user specify page by URL: /category/8?page=3
and then would try to change the language by ?language=en
it will erase previous parameters and take him to first page.
How can I get a current URL and add another parameter to it? I'd like to achieve something like this: /category/8?page=3&language=en
when current ULR is /category/8?page=3
and user tried to change a language.
I tried using ${pageContext.request.requestURL}
but that's not what I look for as it returns jsp page.
Here's a tag file I use. Save it as
/WEB-INF/tags/replaceParam.tag
:Usage in another page (ex url is
/category/9?page=3
):output is
/category/8?page=3&language=en