I'd like to get an URL address of the page that redirects me to another page, in other words suppose that I have three jsp file with the names of one.jsp, two.jsp and three.jsp. the codes of each of them can be seen in the below section:
one.jsp
<a href="two.jsp">go to page two</a>
two.jsp
<%
response.sendRedirect("three.jsp");
%>
three.jsp
<%
out.print(request.getHeader("referer"));
%>
the out put of these will be http://localhost:8080/one.jsp
, but instead I expected to get http://localhost:8080/two.jsp
as the result.
Now I've got two question:
two.jsp
) This behaviour depends on the browser and seems not to be defined, see this question .
Therefore it is simpler to add parameter information about the redirect to the redirect URL and evaluate that parameter in three.jsp
:
two.jsp:
<%response.sendRedirect("three.jsp?source=two");%>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.