String basePath = request.getScheme() + "://" + request.getServerName();
if (request.getServerPort() != 80) {
basePath += ":" + request.getServerPort();
}
basePath += request.getContextPath();
request.setAttribute("basePath", basePath);
request.setAttribute("requestURI", request.getRequestURI());