https://lordofkangs.tistory.com/35
[ JSP ] 서블릿(Servlet) 등록 (web.xml 과 어노테이션)
[ JSP ] Servlet 이란? Servlet이란 Server Application Let의 줄임말이다. Let은 조각을 의미하니 서버의 조각을 Servlet이라고 한다. Servlet은 왜 필요할까? 우선 서버의 필요성부터 알아보자. 서버(Server)란..
lordofkangs.tistory.com
request.getContextPath() 함수 = 프로젝트 Path만 가져옴
예) http://localhost:8080/project/list.jsp
[return] /project 를 가져옴
request.getRequestURI() 함수 = 프로젝트 + 파일경로까지 가져옴
예) http://localhost:8080/project/list.jsp
[return] /project/list.jsp 를 가져옴
String url = request.getRequestURI.split("/");
String Name = url[url.length -1]; // list.jsp
request.getRequestURL() 함수 = 전체 경로를 가져옴
예) http://localhost:8080/project/list.jsp
[return] http://localhost:8080/project/list.jsp
request.ServletPath() 함수 = 파일명만 가져옴
예) http://localhost:8080/project/list.jsp
[return] /list.jsp
request.getRealPath("") 함수 = 서버 or 로컬 웹 애플리케이션 절대경로 가져옴
예) http://localhost:8080/projectname/list.jsp
[return] c:\project\webapps\projectname\