개발/JSP_WEB
jsp 에서 url, path 가져오기
쵸코푸들이장군
2018. 2. 12. 14:51
가령 아래와 같은 주소가 있을 경우
http://localhost:8080/cooper/hello.do
request.getRequestURI(); //프로젝트경로부터 파일까지의 경로값을 얻어옴 (/cooper/hello.do)
request.getContextPath(); //프로젝트의 경로값만 가져옴(/cooper)
request.getRequestURL(); //전체 경로를 가져옴 (http://localhost:8080/cooper/hello.do)
request.getServletPath(); //파일명 (/hello.do)
[출처] request.getRequestURI(); request.