日期:2014-05-18  浏览次数:20747 次

jsf中如何取得当前系统路径
如何在jsf中取当前系统路径啊
象在Struts中的这样

    String   filePath   =   this.getServlet().getServletContext()
                                        .getRealPath( "/ ");
                        System.out.print( "当前系统路径 "+filePath);

谢谢

------解决方案--------------------
FacesContext.getCurrentInstance().getExternalContext().getRequestServletPath();
FacesContext.getCurrentInstance().getExternalContext().getRequestPathInfo();
FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
你自己随便选吧.