通过侦听器重定向页面时,JSF级联样式表不适用

问题描述

|| 我在jsf页面中通过f:event type = \“ preRenderView \” listener = \“#{sessionCheck.loginVerify} \” /使用了以下监听器:
public void loginVerify() {
  try {
    ExternalContext    eCTX    = FacesContext.getCurrentInstance().getExternalContext() ;
    HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();

    // eCTX.redirect(eCTX.getRequestContextPath() + \"/index.xhtml\");
    eCTX.dispatch(\"/index.xhtml\");
  } catch (java.lang.Exception e) {}
}
但是,当我使用重定向或分页时,样式表不会应用于索引页。 索引xhtml中的样式表参考为:
<link href=\"#{facesContext.externalContext.requestContextPath}/resources/css/myStyles.css\" rel=\"styleSheet\" type=\"text/css\"/>
我尝试添加以下样式表ref,但没有区别:
<link href=\"/resources/css/m450.css\" rel=\"styleSheet\" type=\"text/css\"/>  
请问有人必须解决这个问题吗?     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)