Problema primefaces + jsf 2.0 + tomcat 7

7 respostas
gismo

Não estou conseguindo fazer meu primefaces funcionar. A página abre tudo certinho, só que o tema não é aplicado (e nem as funções do prime).

Estou usando as libs do mojarra-2.0.4 (jsf-api e jsf-impl), primefaces2-2.1 e artisto-1.0.0.

web.xml

<?xml version="1.0" encoding="ASCII"?>
<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_3_0.xsd" version="3.0">
  <display-name>PrimeTeste</display-name>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
  </servlet-mapping>
  <context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>artisto</param-value>
  </context-param>  
</web-app>

Página 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.prime.com.tr/ui">

<h:head>

<title>Facelet Title</title>

</h:head>

<h:body>

<h:panelGrid>

<p:messages />

<h:form>

<p:panel closable="true" footer="Cadastro" header="Cadastro de Alunos" style="width: 350PX">

<h:panelGrid columns="2">

<h:outputLabel value="Matricula:"/>

<h:inputText id="matricula" required="true" requiredMessage="Campo [Matricula] obrigatório"/>

<h:outputLabel value="Nome Completo:"/>

<h:inputText id="nome" required="true" requiredMessage="Campo [Nome Completo] obrigatório"/>

<h:outputLabel value="Nome p/ Login:"/>

<h:inputText id="login" required="true" requiredMessage="Campo [Nome p/ login] obrigatório"/>

<h:outputLabel value="Senha:"/>

<p:password minLength="6" promptLabel="Digite uma senha segura"

goodLabel="Boa"

weakLabel="Razoável"

strongLabel="Excelente" />

<h:commandButton value="Cadastrar" />

</h:panelGrid>

</p:panel>

</h:form>

</h:panelGrid>

</h:body>

</html>

Obrigado.

7 Respostas

gilvan.sfilho

Amigo, você provavelmente digitou o nome do tema errado, pelo menos não conheço esse tema e seria muita semelhança no nome…
o nome correto é “aristo”

Verifique isso e veja se funciona.
Abraços

gismo

Hehehe, nem tinha notado isso. Mas mesmo assim ainda não funcionou.
Tem mais alguma ideia?
Obrigado.

E

Eu joguei css e imagem na raiz da web e chamei por

<link type="text/css" rel="stylesheet" href="#{request.contextPath}/skin.css" />

E o web.xml

<context-param> <param-name>primefaces.THEME</param-name> <param-value>none</param-value> </context-param>

Prefiro assim pois futuramente poderei ter vários skin e carregar conforme o cliente.

gismo

De onde vem esse .CSS? Esse comando coloco em minhas páginas .xhtml?
Obrigado.

gismo

Ninguem?

gismo

Resolvi, eu não tinha colocado a lib na pasta lib da WEB-INF. Não sabia que precisava.

Mas agora o que não está funcionando é o tema aristo, ele não pega as cores e os padrões do tema.

Da erro que não acha o theme.css :confused:

OBS: coloquei o jar do aristo na pasta lib da WEB-INF.

Obrigado.

gismo

Coloquei

<context-param>  
    <param-name>primefaces.SKIN</param-name>  
    <param-value>artisto</param-value>  
  </context-param>

e foi… Obrigado a todos :stuck_out_tongue:

Criado 17 de fevereiro de 2011
Ultima resposta 18 de fev. de 2011
Respostas 7
Participantes 3