Is there a way using standard jsf-taglibs, which is rendered to <link>
in the browser? My main goal is to produce a favicon link that should look like this:
<link href="/portal/faces/javax.faces.resource/image/favicon.ico?ln=some.lib" rel="shortcut icon" type="image/x-icon" />
There is no standard JSF component/tag for this.
You can use #{resource}
to convert a JSF resource identifier libraryName:resourceName
to its domain-relative URL representation without the need to manually write down the context path, resource path, JSF mapping and query string.
<link href="#{resource['some.lib:image/favicon.ico']}" rel="shortcut icon" type="image/x-icon" />
If you want to get a step further, then you can always wrap this in a custom tag file in the same line as <h:outputStylesheet>
and friends like so:
<my:favicon library="some.lib" name="image/favicon.ico" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With