开发者

What are the benefits of using JSF2 resources?

开发者 https://www.devze.com 2023-04-09 04:32 出处:网络
Should I use JSF2 resources instead of plain html like <link href... or url(image.png)? What are the benefits? For me this is a bit annoying when web-designer 开发者_如何学Ccreates layout with XHTM

Should I use JSF2 resources instead of plain html like <link href... or url(image.png)? What are the benefits? For me this is a bit annoying when web-designer 开发者_如何学Ccreates layout with XHTML, CSS and all that stuff and I need to spend time to replace plain HTML paths and tags to JSF resource tags like#{resource[...]}.

Is there any other way? Like to put all CSS/image files in web root and use normal links?


Your choice.

The major benefit is that you can declare them on a per-component basis. If you need to include them on every single page anyway, then the benefit is little. But if you need to include component-specific CSS/JS code in for example a composite component which is reused more than once in a single view, then for example an <h:outputScript> in a composite component would end up in it being included only once instead of that many times as the composite component is been used as would happen with <script>. The same applies to the @ResourceDependency annotation on real UIComponent classes.

Please note that you are not required to use JSF2 resources only. Just plain vanilla <img>, <link>, <script>, etc is also perfectly fine. It can even point to the JSF resources folder.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号