JSF取服务器端绝动路径

方式一:
HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
String rootpatch = session.getServletContext().getRealPath("/");
方式二:
public static String getRealPath(String path) 

        return  ((ServletContext) FacesContext.getCurrentInstance()
.getExternalContext().getContext()).getRealPath(path); 
}

posted @ 2008-07-02 11:39  吴碧宇  阅读(666)  评论(0编辑  收藏  举报