I need to refresh the webpage, but in the refresh request I want to add an extra parameter, so I have though in something like:
<c:url value="currentUrl" var="newUrl">
<c:param name="newParam" value="newValue"/>
</c:url>
<a href="${newUrl}">Refresh</a>
How can I get the currentUrl with the params (for instance http://localhost:8080/mywebapp?param1=var1¶m2=var2) of the request from the implicit objects of the jsp. I have though in something like ${pageContext.request.requestURL}, but this returns the url of the jsp, not the request url.
Thanks
If the JSP has been forwarded, you can get the original request URL by ${requestScope['javax.servlet.forward.request_uri']}
and the original request query string by
${requestScope['javax.servlet.forward.query_string']}
.
You can by the way find an overview of all those "hidden" forward attributes here and here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With