如何得到项目的地址,如:http://localhost:8080/HR
方法一:
String url = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
方法二:
String projectUrl = request.getRequestURL().toString();
projectUrl = projectUrl.substring(0, projectUrl.lastIndexOf("/"));