1

在我的项目中,我有一个main_template.xhtml包含所有资源文件的主模板页面。

styles.css在主模板中有一个包含我的页面样式类的。在一个特定页面中,我想排除styles.css资源文件,我该如何实现?

4

1 回答 1

1

与所有其他 UI 组件一样,它<h:outputStylesheet>也支持该rendered属性。您可以通过获取当前视图 IDUIViewRoot#getViewId()并对其进行检查。

所以,拼凑起来的部分看起来像:

<h:outputStylesheet ... rendered="#{view.viewId ne '/specific.xhtml'}" />

也可以看看:

于 2016-08-08T07:22:51.653 回答