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();
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();
'scripting' 카테고리의 다른 글
| [JSP/JAVA] 최상위, 파일 경로 알아내기 (0) | 2010/03/12 |
|---|---|
| [JS,CSS] 잘까먹는 속성, 함수들 (0) | 2010/03/08 |
| [ORACLE] 오라클 테이블 목록 / 컬럼 조회 (0) | 2010/02/22 |
| JSP Request 모든변수 뽑기 (0) | 2010/02/11 |
| Flash ActionScript2 Crossdomain 크로스도메인 설정 (0) | 2009/12/17 |
| Flash ActionScript2 배열 섞기 함수 Array Shuffle (0) | 2009/12/17 |
| JSP Request, PHP 서버변수 모음 (0) | 2009/12/03 |
| as2 fullscreen, contextmenu (0) | 2009/07/03 |
| c# wmv 인코더 (0) | 2009/07/01 |
| flex arraycollection binding on datagrid with image (1) | 2009/06/30 |
| flex warning, 1084: var 'XXXX'의 범위가 기본 네임스페이스인 XXXX: internal로 지정됩니다. 이에 따라 이 패키지 외부에서는 보이지 않습니다. (0) | 2009/06/30 |

댓글을 달아 주세요