2

my css file dosent work.

opera shows me:

http://localhost:8080/formularz-web/faces/javax.faces.resource/css/mycss.css Failed to load resource: the server responded with a status of 404 (Not Found)

netbens shows me:

Warning:   JSF1064: Unable to find or serve resource, css/mycss.css.

its mean my project doesn't see the css file.

in index.xhtml i have:

<html xmlns="http://www.w3c.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Kwestionarisz osobowy - rejestracja PAW</title>
    </h:head>

    <h:body>
        <f:facet name="last">       
            <h:outputStylesheet name="css/mycss.css" />
        </f:facet>
        <h:form styleClass="mycss">

i tried put h:outputStylesheet into h:head.

i tried dont use f:facet.

i tried add library="css".

i tried another path to the file:

h:outputStylesheet name="mycss.css" (delete css folder and put css file directly to webapp

h:outputStylesheet name="src/main/webapp/css/mycss.css"

h:outputStylesheet name="#{request.contextPath}/css/mycss.css"

what do i wrong

Geinmachi
  • 1,251
  • 1
  • 8
  • 20
wezeweze
  • 131
  • 1
  • 3
  • 13
  • http://stackoverflow.com/questions/11988415/what-is-the-jsf-resource-library-for-and-how-should-it-be-used – Geinmachi Jan 02 '16 at 05:55

1 Answers1

1

JSF search for resources (js, css, etc) in /webapp/resources. You have to place your css in a directory like this /webapp/resources/css/mycss.css. In your xhtml/jsf file:

<h:body>
  ..
  <h:outputStylesheet name="mycss.css" library="css" />
DavoCoder
  • 862
  • 6
  • 17
  • Thank you, now works. I have a folder resources but not in the webapp folder. I have him basically in the main folder that contains a webapp. I had to manually do folder resources in the webapp. – wezeweze Jan 02 '16 at 07:25