예를 들어 아래와 같은 URL일 경우

http://127.0.0.1:8080/contextpath/servlcetpath/index.jsp?seq=1&name=test

 

httpServletRequest.getRequestURL()

http://127.0.0.1:8080/contextpath/servlcetpath/index.jsp

 

httpServletRequest.getRequestURI()

/contextpath/servlcetpath/index.jsp?


httpServletRequest.getContextPath()

/contextpath


httpServletRequest.getServletPath()

/servlcetpath/index.jsp

 

httpServletRequest.getQueryString()

seq=1&name=test

 

httpServletRequest.getServerName()

127.0.0.1


httpServletRequest.getServerPort()

8080

 

+ Recent posts