0

I want to include a css file in a folder which in a folder to my jsf page. How can I do that? This is how I place my 'resources' folder

webcontent
|--resources
|  '--css
|    '--font-awesome
|      '--css
|         '--font-awesome.min.css
:

as you can see, my css file is in a css folder which in folder font-awesome which in folder css in folder resources. Below is how I did and it doesn't work

<h:outputStylesheet library="css/font-awesome/css" name="font-awesome.min.css"  />

either this

<link href="${facesContext.externalContext.requestContextPath}/css/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>

or this

<h:outputStylesheet name="css/font-awesome/css/font-awesome.min.css"/>

Please help, Thanks.

  • yo, it is not duplicated. – Pica Troll Jun 26 '15 at 07:10
  • The last one must work. So your "doesn't work" is more likely caused by misconfiguration or misobservation of the actual problem. What results exactly are you expecting and thus focusing on while observing? The average webdeveloper would expect that you verified if the browser successfully downloaded the CSS file by inspecting the webbrowser's HTTP traffic monitor and console. Can you please reconfirm? Does it still return a 404 to the webbrowser? – BalusC Jun 26 '15 at 07:29
  • the css doesn't work, can I send you my project and you take a look, please? – Pica Troll Jun 26 '15 at 07:33
  • Huh? Just elaborate "doesn't work" in webdeveloper's terms instead of enduser's terms. I could imagine that the CSS file is actually successfully loaded (on contrary to what you're implying), but that it is in turn referencing some font files which are in turn not successfully loaded. But you have nowhere stated that. So, press F12 in your webbrowser and pay attention to the console and the HTTP traffic monitor for any clues. – BalusC Jun 26 '15 at 07:33
  • there's no css from that file applied to my page. If I place the css file outside like resources/css/font-awesome.min.css then it works. – Pica Troll Jun 26 '15 at 07:36
  • here's the code that generated in the html page "". I used the last one and my source file is "resources/css/font-awesome/css/font-awesome.min.css". Please help – Pica Troll Jun 26 '15 at 07:42
  • That's helpful information! So, if you're absolutely positive that you didn't made a typo somewhere, then it simply means that the resource doesn't exist during runtime at all. In other words, it isn't physically at the location in the WAR during runtime as you would expect. Did you perform a full clean, rebuild, redeploy and restart to be sure? – BalusC Jun 26 '15 at 07:50
  • wow, thanks bro, thank you so much. I haven't clean and build nor run. It works. Thank you <3 – Pica Troll Jun 26 '15 at 07:58

0 Answers0