protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// http://localhost:8080/DemoName/AServlet?username=xxx&password=yyy
request.getScheme();//獲取協議,http
request.getServerName();//獲取服務器名,localhost
request.getServerPort();//獲取服務器端口,8080
request.getContextPath();//獲取項目名,/DemoName
request.getServletPath();//獲取Servlet路徑,/AServlet
request.getQueryString();//獲取參數部分,即問號後面的部分,username=xxx&password=yyy
request.getRequestURI();//獲取請求URI,即項目名+Servlet路徑,/DemoName/AServlet
request.getRequestURL();//獲取請求URL,等於不包括參數的整個路徑,http://localhost:8080/DemoName/AServlet
}