달력

42024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30


request.getContextPath(); 
request.getRequestURI(); 
request.getHeader("REFERER"); 
request.getRealPath("/")


request.getContextPath()는 프로젝트의 Context path명을 반환한다.

요청 : http://localhost:8080/example/test.jsp 

리턴값 : /example




request.getRequestURI()는 웹전체 경로(프로젝트명+ 파일 경로)까지 반환한다.

요청 : http://localhost:8080/example/test.jsp

리턴값 : /example/test.jsp 




request.getHeader("REFERER")는 요청을 한 부모요청의 URL주소를 반환한다.

현재 페이지:  http://localhost:8080/example/test1.do

요청 페이지 :  http://localhost:8080/example/test.do

리턴값 : http://localhost:8080/example/test.do




request.getRealPath("/")는 서버 또는 로컬의 웹애플리케애션 서버의 docBase 설정값을 반환한다.

요청 : http://localhost:8080/example/test.jsp

리턴값 : D:\Project\webapps\example\


Posted by 한설림
|