webtier@glassfish.java.net

[JSF 2.0]: outputStyleSheet reordering stylesheet

From: <webtier_at_javadesktop.org>
Date: Wed, 08 Jul 2009 23:15:31 PDT

A facelets based view is using the outputStylesheet element to render links to CSS. It seems that the resource management is re-ordering the links. I would expect that they are output in the same order as they were placed in the xhtml file.
Linking to CSS this way does not result in the proper HTML rendered.

<h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Composite oocss module</title>

        <h:outputStylesheet library="oocss.blocks" media="all" name="css/libraries.css" target="head" />
        <h:outputStylesheet library="oocss.blocks" name="css/template.css" target="head" />
        <h:outputStylesheet library="oocss.blocks" name="css/grids.css" target="head" />
        <h:outputStylesheet library="oocss.blocks" name="css/content.css" target="head" />
        <h:outputStylesheet library="oocss.blocks" name="css/mod.css" target="head" />
        <h:outputStylesheet library="oocss.blocks" name="css/mod_skins.css" target="head" />
</h:head>

Switching to"regular" HTML link elements gives me a better result
e.g.:
        <link rel="stylesheet" type="text/css" media="all"
                        href="#{facesContext.externalContext.requestContextPath}/resources/oocss.blocks/0_2/css/libraries.css" />

Dont' know if it is just the ordering causing my problems but I find it strange that the stuff gets rearranged! (Wouldn't this lead to problems where CSS rules may override existing rules by applying some defined CSS loading order?

Next I tried to move the CSS to a composite implementation which messed things up totally!

        <composite:implementation>
                <h:outputStylesheet library="oocss.blocks" name="css/libraries.css" target="head"/>
                <h:outputStylesheet library="oocss.blocks" name="css/template.css" target="head"/>
                <h:outputStylesheet library="oocss.blocks" name="css/grids.css" target="head"/>
                <h:outputStylesheet library="oocss.blocks" name="css/content.css" target="head"/>
                <h:outputStylesheet library="oocss.blocks" name="css/mod.css" target="head"/>
                <h:outputStylesheet library="oocss.blocks" name="css/mod_skins.css" target="head" />

This Some CSS is going to the body while other is going to the head as set by the target attribute.
A bug that I should be reporting or just doing something wrong?
[Message sent by forum member 'mahrer' (mahrer)]

http://forums.java.net/jive/thread.jspa?messageID=354833