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

1

1 Answer 1

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" /> 
Sign up to request clarification or add additional context in comments.

1 Comment

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.