'getrealpath'에 해당되는 글 1건

 
  1. 2010.03.12 [JSP/JAVA] 최상위, 파일 경로 알아내기
2010. 3. 12. 04:46 COMPUTER/JAVA, JSP
[JSP/JAVA] 최상위, 파일 경로 알아내기
JSP/Servlet 사이트 경로 1 (드라이브:\사이트경로\)
String strRoot=request.getSession().getServletContext().getRealPath("/");
out.println(strRoot);

JSP/Servlet 사이트 경로 2 (드라이브:\사이트경로\)
String strRoot=getServletContext().getRealPath("/");
out.println(strRoot);

JSP/Servlet 특정 페이지 경로
String strRealPath=getServletContext().getRealPath("경로/파일명");
strRealPath=strRealPath.substring(0,strRealPath.lastIndexOf(System.getProperty("file.separator")));
out.println(strRealPath);

JSP/Servlet 현재 페이지 경로
String strRealPath=getServletContext().getRealPath(request.getRequestURI());
strRealPath=strRealPath.substring(0,strRealPath.lastIndexOf(System.getProperty("file.separator")));
out.println(strRealPath);

JAVA - 현재 클래스 경로
this.getClass().getResource("").getPath();


JAVA - 클래스 디렉토리 경로
this.getClass().getResource("/").getPath();

최근에 올라온 글

최근에 달린 댓글