반응형
Notice
Recent Posts
Recent Comments
Link
«   2025/03   »
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 31
Tags
more
Archives
Today
Total
관리 메뉴

스터디 용 블로그

[JSP]getContextPath()와 getRequestURI(), request.getRealPath("/")의 차이 본문

카테고리 없음

[JSP]getContextPath()와 getRequestURI(), request.getRealPath("/")의 차이

워후 2015. 1. 19. 14:07
반응형


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\

반응형
Comments