首页 > 编程 > Java > 正文

java获得URL

2019-11-08 01:58:49
字体:
来源:转载
供稿:网友

java获得完整的url

String strUrl = "http://" + res.getServerName() //服务器地址                  + ":"                   + res.getServerPort()           //端口号                  + res.getContextPath()      //项目名称                  + res.getServletPath()      //请求页面或其他地址              + "?" + (res.getQueryString()); //参数  		System.out.PRintln(strUrll);


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表