2009年12月11日 星期五

getservletcontext-與-getrealpath

String myJrxmlFile = this.getServletContext().getRealPath(myJrxmlWebPath);

getServletContext() : Returns a reference to the ServletContext in which the caller is executing.
getRealPath(java.lang.String path)
Returns a String containing the real path for a given virtual path.

這樣可以輕易的把我們要用的檔案拿來使用.

沒有留言: