开发者

JSF h:outputStylesheet renders nothing

This

<html xmlns="http://www.w3.org/1999/xh开发者_如何学运维tml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">

<h:outputStylesheet name="test.css" />

renders nothing. Do I have to add some configuration? The test.css is avaible in my resource folder.


JSF injects stylesheets to either HTML head or body elements (head is the default, IIRC). For JSF to find head or body, you have to declare them as <h:head></h:head> and <h:body></h:body> (not plain <head></head> etc).


JSF will inject scripts inline at the tag location if you omit the target, so using <h:outputScript> will work if even you don't have <h:head> or <h:body> tags. The <h:outputStylesheet> tag will alway inject into the head section regardless of target, so there has to be <h:head> elements defined in order to use that tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜