假如该页面是http://a.jsp,,
如何在a.jsp使用一个变量得到该url,即http://a.jsp
request.getRequestURI()能够得到本页面的相对路径
用你的例子即"a.jsp"
用javascript就可以得到
alert(window.location.href);
request.getRequestURL()
本文介绍了如何使用Java和JavaScript在Web开发中获取当前页面的URL。对于Java,可以通过`request.getRequestURI()`和`request.getRequestURL()`来获得相对路径和完整的URL;而JavaScript则可以直接通过`window.location.href`来获取完整的URL地址。
假如该页面是http://a.jsp,,
如何在a.jsp使用一个变量得到该url,即http://a.jsp
request.getRequestURI()能够得到本页面的相对路径
用你的例子即"a.jsp"
用javascript就可以得到
alert(window.location.href);
request.getRequestURL()

被折叠的 条评论
为什么被折叠?