File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes h:outputStylesheet link ordering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "h:outputStylesheet link ordering" Watch "h:outputStylesheet link ordering" New topic

h:outputStylesheet link ordering

Ted Smyth
Ranch Hand

Joined: May 28, 2008
Posts: 73
Running a JSF 2, PrimeFaces, Spring 3 MVC/WebFlow application and I've run into an issue with JSF's <h: outputStylesheet> tag. Specifically the order in which it renders all of the specified stylesheets.

PrimeFaces uses themes and a number of CSS fiels which are linked in using the JSF resource loading mechanism (in some arcane manner hidden from the developer). I am overriding certain PrimeFaces CSS classes to tweak the look & feel with a custom style.css file (which naturally, must be the final .css file linked on the rendered html).

All that to say, the stylesheets are being rendered in a bizarre order. On initial page load (after application deployment), the style.css link appears at the top of the script links:

yet after hitting refresh, the style.css link appears at the end:

Is there any way to ensure the order in which style sheets are included on the page? Seems like Mojarra/PrimeFaces are not respecting the order in which I write the includes.

Edward Smith
I agree. Here's the link:
subject: h:outputStylesheet link ordering
jQuery in Action, 3rd edition