Olá pessoal,
Estou tentando resolver o problema faz dias e não consigo. Já vi problemas parecidos, mas nenhum deles funcionou comigo.
Estou usando o Eclipse Juno, Apache 6, JSF 2.1, Primefaces 3.5 e Spring 3.0.
Tudo certo, com exceção do CSS que não roda de jeito nenhum nas .XHTML.
Funciona se eu colocar o mesmo codigo do CSS no próprio .XHTML.
Ajudem por favor.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Sistema</display-name>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<session-config>
<session-timeout>5</session-timeout>
</session-config>
<!-- Spring framework -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- FIM Spring framework -->
<!-- Spring security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<!-- FIM Spring security -->
</web-app>
index.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Sistema</title>
<link href="${facesContext.externalContext.requestContextPath}/css/p.css" rel="stylesheet" type="text/css" media="screen" />
</h:head>
<h:body>
<div>
<div id="logomarca">LOGOMARCA</div>
<div id="titulo">Sistema em desenvolvimento</div>
<div id="usuario">
login: <a >login</a>
</div>
<div id="menu">
<p:menubar>
<p:menuitem value="Home" url="index.xhtml" icon="ui-icon-home" />
</p:menubar>
</div>
</div>
</h:body>
</html>
p.css
*{
margin: 2; /*Zera todo o espaçamento EXTERNO entre as DIV's*/
padding: 0; /*Zera todo o espaçamento INTERNO das DIV's*/
}
#cabecalho {
display: block;
height: 120px;
}
#logomarca {
height: 60px;
width: 200px;
position: fixed;
top: 2px;
left: 2px;
}
#titulo {
align: center;
}
#usuario {
height: 60px;
border-right-style: solid;
border-left-style: solid;
border-bottom-style: solid;
border-top-style: solid;
border-right-width: 2px;
border-left-width: 2px;
border-bottom-width: 2px;
border-top-width: 2px;
border-right-color: silver;
border-left-color: silver;
border-bottom-color: silver;
border-top-color: silver;
background-color: #009900;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-style: normal;
font-size: 10px;
width: 150px;
position: fixed;
top: 2px;
right: 2px;
}
#menu {
height: 60px;
position: fixed;
top: 60px;
width: 100%;
}
estrutura dos diretórios
WebContent
css
p.css
WEB-INF
...
index.xhtml