0

I've created sample for JSF template. I did new file... Faceletes Template and CSS file is created by NetBeans itself. However when I try run my project there is normal text

Top

Content

and that's it. Semms like isn't connected with CSS...?

<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <h:outputStylesheet name="default.css" library="css"/>
    <h:outputStylesheet name="cssLayout.css" library="css"/>
    <title>Facelets Template</title>
</h:head>

What is interesting when I do change in web.xml file:

<welcome-file-list>
    <welcome-file>faces/template.xhtml</welcome-file>
</welcome-file-list>

And welcome file is template.xhtml instead of index.html it works well but client page when I would use my template still is doesn't read css

<ui:composition template="./template.xhtml">

I really have read much info but I can't find solution. I have done everything form How to reference CSS / JS / image resource in Facelets template? and my project still does not work.

My env: NetBeans IDE 8.0.2
Java EE 7 GlassFish 4.1 JSF 2.2

Community
  • 1
  • 1
Hubb
  • 33
  • 2
  • Stop generating code. Instead, write code yourself. Do so as long as until you understand every single line/aspect of autogenerated code. The link you found clearly says to declare css in not when using templating. The new duplicate link shows how to properly create/use templates themselves. If you still stucks, post a MCVE, not some incomplete code which makes the question very ambiguous. – BalusC Jan 12 '16 at 13:22
  • Solved. The problem was in the path. localhost:8080/WebApplication/clinetpage.xhtml wasn't proper because only tags Firefox shows. The proper path is localhost:8080/WebApplication/faces/clientpage.xhtml as file web.xml says. This was the solution. – Hubb Jan 12 '16 at 17:37

0 Answers0