获取调用页面的URL Java [英] Getting the URL of the calling page Java
问题描述
为了说明这一点,我们使用基于Tomcat 6.0.29的自定义服务器。我们正在使用Java和Spring开发。
To put you in the picture, we're using a custom server based on Tomcat 6.0.29. We're developing using Java and Spring.
假设我有一个链接,您可以从 http:// localhost / display 到 http:// localhost / save 。在 http:// localhost / save 的控制器中,我可以获取 http:/ / localhost / display 。
Let's say I have a link which takes you from http://localhost/display to http://localhost/save. In the controller of http://localhost/save, can I get http://localhost/display from the request parameter somehow?
request.getRequestURL()
获取当前页面的网址。
request.getRequestURL()
seems to get the url of the current page.
推荐答案
这应该给你的推荐页面(大多数情况下)
This should give you the referring page (is most cases)
request.getHeader("referer");
详情请参阅这里 http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z14
并且此处查看请求API
这篇关于获取调用页面的URL Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!