如果你請求的URL是 http://localhost:8080/demo/Index.jsp
request.getScheme() ~~~~~~> http
request.getServerName() ~~~~~~> localhost
request.getServerPort() ~~~~~~~~~> 8080
request.getContextPath() ~~~~~~> /demo
request.getRequestPath() ~~~~~~~> /Index.jsp
request.gerRequestURI() ~~~~~~~> /demo/Index.jsp
request.getRequestURL() ~~~~~~~> http://localhost:8080/demo/Index.jsp
request.getRealPath("") ~~~~~~~~~> D:\apache-tomcat-6.0.10\webapps\demo
別人寫的http://blog.csdn.net/luobo525/archive/2006/11/21/1401577.aspx