Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What advantages do JSF's h:outputScript/ h:outputStylesheet have over plain HTML script/style elements

Is it preferable to use JSF's h:outputScript or h:outputStylesheet when script/style elements may just work for you ? What advantages does former offer over the latter ?

like image 953
Rajat Gupta Avatar asked Sep 18 '13 10:09

Rajat Gupta


1 Answers

The JSF builtin resource handling has at least the following advantages:

  • Resource versioning
  • Configurable cache control
  • Packaging in JAR
  • Programmatic (component based) manipulation
  • Automatic prepending of right context path
  • EL support in CSS files
  • i18n support (different resource files based on user's locale)
  • Automatic HTTP/2 push (JSF 2.3+ on HTTPS only)

See also:

  • How to reference CSS / JS / image resource in Facelets template?
  • What is the JSF resource library for and how should it be used?
like image 80
BalusC Avatar answered Nov 15 '22 05:11

BalusC