For example, there is a connection inside the page, and the complete path should be http://192.168.0.1:8080/myblog/authen/login.do
Where HTTP://server/is the basic path of the server, MyBlog is the name of the current application, then my root path should be so http://localhost:80/myblog/.
String path = Request.getcontextpath ();
String basepath = Request.getscheme ()+ "://"+request.getservername () + ":" +request.getserverport () +path+ "/";
<base href= "<%=basePath%>" >
This statement is used to assemble the relative path of the current page.
Request.getschema () can return the protocol used by the current page, which is "http" in the example above
Request.getservername () can return the name of the server on which the current page is located, or "localhost" in the example above
Request.getserverport () can return the port used by the server on which the current page is located, or 8080,
Request.getcontextpath () can return the name of the application in which the current page is located, which is the myblog in the example above
1. Get the server IP, port, etc.