Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh adding an extra parameter

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&param2=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

like image 725
Javi Avatar asked Dec 01 '10 10:12

Javi


1 Answers

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.

like image 80
BalusC Avatar answered Oct 11 '22 04:10

BalusC