美文网首页
获取端口

获取端口

作者: 程序员小韩 | 来源:发表于2017-09-01 16:14 被阅读0次

后台:

HttpServletRequest httpRequest=(HttpServletRequest)request;

String strBackUrl = "http://" + request.getServerName() //服务器地址

+ ":"

+ request.getServerPort()           //端口号

+ httpRequest.getContextPath()      //项目名称

+ httpRequest.getServletPath()      //请求页面或其他地址

+ "?" + (httpRequest.getQueryString()); //参数

前台:

var url = window.location.href; //协议+ip+端口号

相关文章

网友评论

      本文标题:获取端口

      本文链接:https://www.haomeiwen.com/subject/lwlkjxtx.html