language/자바

자바 HttpServletRequest

찬린이 2022. 1. 27. 13:29

HttpServletRequest

 

이러한 URL이있다하자

URL : http://127.0.0.1:8080/contextpath/servletpath/index.jsp?type=post


getRequestURL() : http://127.0.0.1:8080/contextpath/servlcetpath/index.jsp
getRequestURI() : /contextpath/servletpath/index.jsp

 - 프로젝트이름 + 파일경로
getServletPath() : /servletpath/index.jsp

getContextPath() : /contextpath

 - 프로젝트이름
getQueryString() : type=post

  - '?' 다음 내용이다.
getServerName() : 127.0.0.1
getServerPort() : 8080