1.假设当前页完整地址是:http://localhost:61768/Home/Index?id=2 //获取当前窗口的Url var url = window.location.href; //结果:http://localhost:61768/Home/Index?id=2 //获取当前窗口的主机名 var host = window.location.host; //结果:localhost:61768 //获取当前窗口的端口 var port = window.location.por
1.request.getRequestURL() 返回的是完整的url,包括Http协议,端口号,servlet名字和映射路径,但它不包含请求参数.2.request.getRequestURI() 得到的是request URL的部分值,并且web容器没有decode过的 3.request.getContextPath() 返回 the context of the request. 4.request.getServletPath() 返回调用servlet的部分url. 5.reque
//Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request // eg. /manage/editExam.domethod=goExamSet&type=U String url = request.getRequestURI(); //The re