This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I have doubts that your EL in your CSS file really works. At least if it's a real CSS file retrieved by a real URL.
Your CSS also has another issue. The FacesContext is not a permanent or long-term object. It exists only for the duration of the request process for the URL. If that URL wasn't routed to the FacesServlet, the FacesContext won't exist for that request.
So the only way you could get EL to work in either js or css files would be to brute-force include them as part of the source of a JSF page. If they're fetched as distinct URLs (such as via the <LINK> element, they won't go through the EL processor.
The outputScript and outputStyleSheet elements are new to JSF2 and the documentation I've found for them is pretty vile and looks to be more for the benefit of the tag implementor than it is for people who are actually using the tag. But as far as I'm aware, these elements do NOT route their respective resources through the FacesServlet, they just generate JSF-friendly HTML. Primarily that means that the output URLs know about the servlet context path without making you supply it explicitly.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Mar 13, 2012
Hello tim, thank you for your help.
But i'm doubt about your comments on putputScript and putputStylesheet.
I analysed the page rendered (html created by server) and i saw the follow:
Tabs Primefaces after rendered in the html:
Note that after rendered was created a link for the JSF resources. And same link was created for archive with extension xhtml and not with js
Those aren't PrimeFaces tags. Tags in the "h" namespace come from the Core JSF2 tagset.
But you're right. If it went to all the trouble of constructing an "xhtml" URL, it should be passing through something.
The one thing that doesn't ring quite true, however, is that an ".xhtml" URL doesn't get routed to the FacesServlet, normally. Instead, you'd request a ".jsf" URL and the FacesServlet would break it down, locate the .xhtml resource that matched the basename, and process that. So I'm not quite sure what's going on here. I need to try these critters myself. I missed hearing about them, and have been using the RichFaces equivalents, instead. Until JSF2 came out, that was the only way to do this kind of stuff, so that's what I've been coding.