How to specify resource library version in JSF2?

一世执手 提交于 2019-12-01 04:34:12

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/9868068/how-to-specify-resource-library-version-in-jsf2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!