java中獲得系統路徑
在Application中:System.getProperty("user.dir")
在Servlet中:
ServletContext servletContext = config.getServletContext();
String rootPath = servletContext.getRealPath("/");
在自定義標簽中,分布式環境下,用
((HttpServletRequest) this.pageContext.getRequest()).getContextPath();獲取web的路徑,
如“\web”
在jsp中:
application.getRealPath("")
posted on 2007-09-03 17:24 夏雪 閱讀(230) 評論(0) 編輯 收藏 所屬分類: Java基礎研究