6

Say I have a resources/ folder in the webroot. In it, I have a css/ folder and in it there is a theme.css file.

But I want to set an Expires: header. Therefore I want to use a version for resource libraries, say

<h:outputStylesheet library="css" name="theme.css"/>

would turn into

<link rel="stylesheet" src="javax.faces.resources/theme.css.xhtml?ln=css"/>

But I want to specify something like

<h:outputStylesheet library="css" name="theme.css" version="1.2"/>

And get

<link rel="stylesheet" src="javax.faces.resources/theme.css.xhtml?ln=css&v=1_2"/>

or similar. I have read that JSF2 has support for resource versioning, but how do I specify which version to load, and where do I put the files?

P Varga
  • 19,174
  • 12
  • 70
  • 108

1 Answers1

3

If you suppose to have the css library, you should use this directories naming scheme:

resources/css/1_1
resources/css/1_2

where resources in the jsf standard resource directory

landal79
  • 1,520
  • 1
  • 11
  • 26
  • And how do I specify the version in the JSF file? (in reality there is no version= attribute) – P Varga Mar 26 '12 at 08:16
  • 1
    I found that if you don't specify version JSf takes the highest, if you want to specify a version, you can do as follow: `` – landal79 Mar 26 '12 at 09:06
  • Thanks, I will try that! Though I noticed that new versions of MyFaces don't allow / characters in a library name, but I always want the latest version anyways. – P Varga Mar 26 '12 at 11:40
  • 4
    Library name is also not intented to be set with resource content type, but with the common resource library name. This is indeed a pretty common mistake. I really don't understand why everyone starts using "js", "css", "image" as library name. If you don't have a library, just omit it. – BalusC Mar 26 '12 at 12:06