Prime faces does not run the theme "SAM"

Asked

Viewed 172 times

0

When I run my main.xhtml page the theme is not displayed next to the pageinserir a descrição da imagem aqui

The tree of the project is attached.

inserir a descrição da imagem aqui

Web file.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>semeru_jsf_maven</display-name> 

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>  
<!-- Duração da sessão -->
<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>
<!-- Configurações do tema do PrimeFaces -->

 <context-param>
<param-name> primefaces.THEME </ param-name>
<valor param> sam </ param-value>
</ context-param>

<!-- Configurações do PrimeFaces --> 
<servlet>
    <servlet-name>Resource Servlet</servlet-name>
    <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>Resource Servlet</servlet-name>
    <url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>    

File faces-config.xml

<?xml version="1.0" encoding="UTF-8"?><faces-config xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
          version="2.0">

<lifecycle>
    <phase-listener>br.com.semeru.util.PhaseListenerSemeru</phase-listener>
</lifecycle>

Main file.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">

<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <h:outputStylesheet name="./css/default.css"/>
    <h:outputStylesheet name="./css/cssLayout.css"/>
    <title>Facelets Template</title>
</h:head>

<h:body>

    <div id="top">
        <ui:insert name="top">Top</ui:insert>
    </div>

    <div id="content" class="center_content">
        <ui:insert name="content">Content</ui:insert>
    </div>

    <div id="bottom">
        <ui:insert name="bottom">Bottom</ui:insert>
    </div>

</h:body>

Someone could help me with this project, I’m layman when using the Primefaces.

  • Have you included in your project the lib of the theme? http://repository.primefaces.org/org/primefaces/themes/sam/1.0.10/

  • Rodrigo I include the theme "SAM" in a library and added to the project, I put an attachment to my project tree, I’m new with the primefaces, so I get a little lost!

1 answer

2


The error is in your Web.xml. In this part:

<!-- Configurações do tema do PrimeFaces -->
<context-param>  
  <param-name>META-INF.maven.org.primefaces.themes.sam</param-name>  
  <param-value>sam</param-value>  
</context-param>

The correct way to use a theme in Primefaces is this way:

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

Source: http://www.primefaces.org/themes

  • adelmo00 I put the code informed by vc, for use of the primefaces, and msm so it still displays me the same page.

  • @Michellxexeu saw that the name of your theme is sam. This theme is in the correct directory or the . jar is mapped in pom.xml?

  • Adelmo00 includes the project tree above, I added the sam theme in a lib.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.