Using bootstrap 3 glypicons with webjars and jsf2.2

非 Y 不嫁゛ 提交于 2019-12-04 09:09:53

You should use <link> tag instead of <h:outputStylesheet> eg.

<link rel="stylesheet" type="text/css" media="all" href="webjars/bootstrap/3.1.1/css/bootstrap.min.css"/>

--- UPDATE
This happen because ResourceHandler in JSF add library value (webjars) to the end of URI as a parameter: faces/javax.faces.resource/bootstrap/3.1.1/css/bootstrap.min.css?ln=webjars

in bootstrap.min.css CSS there are such references to files: url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),

so if you want to use <h:outputStylesheet> you can write own ResourceHander or you can edit bootstrap.min.css and fix paths to glyphicons-halflings-regular.* files

In my opinion is better to use standard html tag <link> instead of <h:outputStylesheet> because JSF component tree will be smaller and it act on performance. Inside bootstrap.min.css there is no EL so there is no need to use <h:outputStylesheet>

Small update: webjars has JSF specific versions of several CSS libraries, in case of the bootstrap CSS the following will work just fine:

<h:outputStylesheet library="webjars" name="bootstrap/3.3.5/css/bootstrap-jsf.css" />

Note the -jsf suffix.

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