jsp获取相对地址与url地址

String path=getServletContext().getRealPath("/");
System.out.println(path);

String   url=request.getScheme()+"://";   
url+=request.getHeader("host");   
   
System.out.println(url);
if(request.getQueryString()!=null)   
      url+="?"+request.getQueryString();   
    String aa=request.getQueryString();
    url+=request.getRequestURI();

你可能感兴趣的:(java,jsp)