I am using request.getHeader("Referer") to get the previous page URL from where I came. But I am getting here the complete URL for example http://hostname/name/myPage.jsp?param=7. Is there any way to extract myPage.jsp?param=7from the whole URL? Or I need to process the string?I just need myPage.jsp?param=7.
I am using request.getHeader(Referer) to get the previous page URL from where I came.
Share
You can simply reconstruct URL by using this function. Use only the things you need from this function.
or If this function does not fulfil your need, then you can always use String manipulation:
Pass in /sub/dir/path.html returns path.html
Hope this helps. 🙂