#.java获取请求路径的工具类


// 获取请求路径
     public static String getPath(HttpServletRequest request) {
           //获取请求路径
           String requestURI = request.getRequestURI();
           //获取get请求中的请求参数
           String queryString = request.getQueryString();
           String path = requestURI + "?" + queryString;
           if (path.contains("&pageNo")) {
                path = path.substring(0, path.indexOf("&pageNo"));
           }
           return path;
     }
         

你可能感兴趣的:(代码片段大全)