在JSF支持Bean(Managed Bean的,虚焊豆,无所谓),我可以得到上下文路径的客户端是通过调用
FacesContext ctx = FacesContext.getCurrentInstance();
String path = ctx.getExternalContext().getRequestContextPath();
Run Code Online (Sandbox Code Playgroud)
这给了我客户端当前访问的路径,比如/myapplication
.是否也可以得到当前页面,就像/home.faces
,怎么样?