在JSF的后端Bean(Managed Bean,Weld Bean都可以)中,我可以通过调用以下方法来获取客户端所在上下文路径:
FacesContext ctx = FacesContext.getCurrentInstance();
String path = ctx.getExternalContext().getRequestContextPath();
这个代码给出了客户端目前正在访问的路径,例如/myapplication
。
是否也可以获取当前的页面,比如 /home.faces
,该怎么做?