Back-end/JSP
-
절대경로 ContextPath 가져오는 방법Back-end/JSP 2020. 1. 3. 13:48
웹 페이지이 경로에 따른 리소스 참조 문제- 파일에 대한 참조를 상대 경로로 처리하는 경우컨트롤러의 URL 에 따라 상위 경로를 통한 참조인지 현재 경로에서 시작되는 참조인지를구분 해야 한다. 즉 리소스에 대한 참조 경로가 매번 변경된다. -파일에 대한 참조를 절대경로로 처리하는 경우리로스에 대한 참조가 컨트롤러의 위치에 상관 없이 일정하게 유지된다. ContextPath를 가져오는 방법ㆍ JAVA웹 프로그램에서의 현재 프로젝트 경로를 ContextPath라고 한다. ㆍ서블릿이나 JSP의 JAVA소스코드에서의 처리request.getContextPath() ㆍJSTL에서의 처리${pageContext.request.contextPath}