0

When I put my style css in the same xhtml page, it's work with me page, like :

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">
<h:head>
<style>
.ui-dialog-titlebar{
    color:red;
}
.ui-dialog-title{
background-color: green;
}
</style>
</h:head>
<h:body>
<p:panelGrid  style="border:hidden" >
      <h:form>
        <p:row>
<p:column style="font-weight: bold;border:hidden;">
                <p:commandLink id="ajax" update="growl" actionListener="#{dfView.showMessage}" onclick="PF('dlg1').show();">
                    <h:outputText value="Log in" />
                </p:commandLink>
            </p:column>
</p:row>
      </h:form>
    </p:panelGrid>

<p:dialog header="Log in" widgetVar="dlg1" modal="true" height="300" dynamic="true">
</p:dialog>

<div  class="index_center_text">

</div>

</h:body>
</html>

in this cas I can style my dialog header. But I need to put all my css in a separate file and load only its url.

I tried to do something like :

1-

<h:body>
<h:outputStylesheet name="/resources/css/style.css" />
...
</h:body>

2-

<h:body>
<h:outputStylesheet name="/css/style.css" />
...
</h:body>

3-

<h:head>
    <f:facet name="last">
    <h:outputStylesheet name="/resources/css/style.css" /> 
    </f:facet>
</h:head>

4-

<h:head>
<link rel="stylesheet" media="screen" href="resources/css/style.css" type="text/css" />
</h:head>

5-

<h:head>
<link rel="stylesheet" media="screen" href="css/style.css" type="text/css" />
</h:head>

And style.css :

.ui-dialog-titlebar{
    color:red;
}
.ui-dialog-title{
background-color: green;
}
.index_center_text{

    height:200px;
    width:100%;
    background-color:#E9F3FF
}

but all these don't work with me .

Folder structure

WebContent
 |-- META-INF
 |-- resources
 |    |-- css
 |    |    `-- style.css
 |    `-- images
 |         |-- logo.png
 |-- WEB-INF
 |    |-- bib
 |    |-- faces-config.xml
 |    |-- web.xml
 |         
 |-- index.xhtml

please anybody can help me !

Edited :

Thank you so much @BalusC I did what you told me. I found these:

1- when I use <h:outputStylesheet name="/css/style.css" /> , the response while requesting style.css file like :

@CHARSET "ISO-8859-1";
.ui-box{

    border-color: red;
}

.overlayDialog div.ui-dialog-titlebar{
    background-color: green;
    }

(there is no index_center_text class)

2- when I use this <h:outputStylesheet name="/resources/css/style.css" />, it didn't reach to my css file (no response)

3- when I use <h:outputStylesheet library="css" name="style.css" /> , the response while requesting style.css file like :

@CHARSET "ISO-8859-1";
.ui-dialog-titlebar{
    color:red;
}
.ui-dialog-title{
background-color: green;
}
.index_center_text{

    height:200px;
    width:100%;
    background-color:#E9F3FF
}

but the problem it doesn't style my div :

<div  class="index_center_text">

</div> 

Note :

I remark that when I change my css it doesn't really change it because when I check my request using firebug for example. it takes into consideration the old css still there ... Amazing Although I clean and build many times my project , the problem still here.

pnuts
  • 58,317
  • 11
  • 87
  • 139
laciane
  • 17
  • 3
  • http://stackoverflow.com/q/11988415/1391249 – Tiny Jun 21 '15 at 16:18
  • Thanks you so much . @BalusC I have edited my post , please take a look. – laciane Jun 22 '15 at 11:35
  • please keep everything in 'order' you switched 1 and 2 above... So '2' works... it is loaded... Problem solved isn't it? – Kukeltje Jun 22 '15 at 11:40
  • @Kukeltje it loaded yes but it didn't my div with the index_center_text class which is in style.css although style.css file loaded – laciane Jun 22 '15 at 12:25
  • I remark that when I change my css it desn't really change it because when I check my request I saw the old css still there ... Amazing Although I clean and build many times my project , the problem still here. – laciane Jun 22 '15 at 14:38
  • @BalusC : I refresh I tried with google chrome and firefox the same result it didn't take into consideration my changes...Amazing – laciane Jun 22 '15 at 14:52
  • I didn't find the bin folder for delete it and deploy a new one ,where is it ? – laciane Jun 22 '15 at 15:06

0 Answers0