Problema RichFaces com Facelets

4 respostas
D

Boa tarde pessoal, gostaria da ajuda de vcs, estou começando a utilizar Facelets em meu projeto onde uso jsf, criei um template, porem em meu projeto utilizo os componetes do hichfaces onde incluia as tag no JSP assim: <%@taglib uri="http://richfaces.org/rich" prefix="rich"%> e funciona normalmente
Agora como os arquivos tem que ser .xhtml, nao esta sendo possivel a utilização das tag hicfaces, alguem poderia me ajudar, pois ja procurei na nete nada , onde ja utilizei xmlns:rich="http://richfaces.org/rich">, mais nada funciona, alguem ja teve esse problema? segue meu codigo abaixo

Template.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:ui="http://java.sun.com/jsf/facelets">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Facelets - Template Example</title>
        <link href="./css/default.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
        <div id="topDIV">
        <ui:include src="inc/topo.jsp"/>
        </div>

         <div id="contDIV">
             <ui:insert name="cont">This is Default cout </ui:insert>
        </div>

        <div id="bottomDIV" >
        <ui:include src="inc/rodape.jsp"/>
        </div>
    </body>
    
</html>

Home.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:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:rich="http://richfaces.org/rich">

    <body>
        <ui:composition template="/template.xhtml">
            <ui:define name="cont">
                My Home Page
                Clik no link para segunda pagina
                
                <h:form>
                    <h:commandLink action="gotoSecondPage" value="SecodPage"/>
                </h:form>
            </ui:define>
        </ui:composition>

    </body>

</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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-app_2_5.xsd">
     <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
      
    <context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>
    <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>*.jsf</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>forward.jsp</welcome-file>
        </welcome-file-list>
    </web-app>

feaces-config

<?xml version='1.0' encoding='UTF-8'?>

<!-- =========== FULL CONFIGURATION FILE ================================== -->

<faces-config version="1.2" 
    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_1_2.xsd">

    <application>
        <view-handler>
            com.sun.facelets.FaceletViewHandler
        </view-handler>    
    </application>
    
    <navigation-rule>
        <from-view-id>/home.xhtml</from-view-id>
        <navigation-case>
            <from-outcome>gotoSecondPage</from-outcome>
            <to-view-id>/second.xhtml</to-view-id>
            <redirect/>
        </navigation-case>
    </navigation-rule>
</faces-config>

4 Respostas

rsakurai

Boa tarde

no seu Template.xhtml

coloque o que estiver no body dentro de um (xmlns:f="http://java.sun.com/jsf/core")
<body>
 <f:view>
 </f:view>
</body>

outra coisa, quando vc acessa a pagina Home.xhtml aparece algo na tela, porque deveria pelo menos aparecer o que esta no seu Template, se não mostra nada é porque ele não esta encontrando o template através do

D

Boa tarde rsakurai, obrigado pela atenção, fiz a alteração no template

<?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:ui="http://java.sun.com/jsf/facelets">   
    <head>   
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />   
        <title>Facelets - Template Example</title>   
        <link href="./css/default.css" rel="stylesheet" type="text/css" />   
    </head>   
       
    <body>  
         <f:view>
        <div id="topDIV">   
        <ui:include src="inc/topo.jsp"/>   
        </div>   
  
         <div id="contDIV">   
             <ui:insert name="cont">This is Default cout </ui:insert>   
        </div>   
  
        <div id="bottomDIV" >   
        <ui:include src="inc/rodape.jsp"/>   
        </div>   
     </f:view>
    </body>   
       </html>

Minha pagina home .xhtml esta carregando normalmente template tudo certinho , porem o problema é que minha tag rich nao funciona (não acha quando digito rich:...).
quando tiro todo o bloco:
[code] xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich">
[quote]

As tag h,f,ui continuam funcionando normalmente, mas a rich o form não acha, parece que o bloco acima não ta fazendo diferença nenhuma..
Oque será q estou fazendo de errado?

rsakurai

Mas se vc escrever na “mão” todo o codigo da tag do rich faces, aparece o componente na tela?

Porque o problema pode ser só o auto-complete.

Icecold

Se informo manualmente o componente aparece na tela normalmente. Como resolver este problema do auto complete para exibição das tags richfaces. Acontece que o auto complete para de funcionar para todas as tags jsf core e jsf html mas os componentes são exibidos normalmente

Criado 14 de maio de 2009
Ultima resposta 17 de ago. de 2009
Respostas 4
Participantes 3