Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的项目中,我有一个main_template.xhtml包含所有资源文件的主模板页面。
main_template.xhtml
我styles.css在主模板中有一个包含我的页面样式类的。在一个特定页面中,我想排除styles.css资源文件,我该如何实现?
styles.css
与所有其他 UI 组件一样,它<h:outputStylesheet>也支持该rendered属性。您可以通过获取当前视图 IDUIViewRoot#getViewId()并对其进行检查。
<h:outputStylesheet>
rendered
UIViewRoot#getViewId()
所以,拼凑起来的部分看起来像:
<h:outputStylesheet ... rendered="#{view.viewId ne '/specific.xhtml'}" />