RichFaces + Tomahawk + Myfaces é possivel?

6 respostas
ld50

Estou tentando utilizar RichFaces3.1.3 + Tomahawk1.1.6 + MyFaces 1.1.5 porem estou tendo alguns problemas relacionados principalmente ao atributo rendered das tags da maioria dos componentes…

sempre que existe um componente de ação (link, button) com o atributto rendered variavel o mesmo para de chamar o metodo do meu bean que esta associado ao atributo action do componente…

não sei se isso é um bug, uma incompatibilidade ou um erro no meu web.xml

ja tentei fazer diversas modificações neste arquivo porem sem resultado
abaixo meu web.xml

<?xml version="1.0"?>
<!--
 * Copyright 2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * UPDATED: Marty Hall changed to use .faces suffix,
 *          faces-config.xml filename, and servlets 2.4.
-->

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    
    <!-- Extensions Filter -->
    <filter>
	<filter-name>MyFacesExtensionsFilter</filter-name>
	<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
        <init-param>
            <param-name>maxFileSize</param-name>
            <param-value>20m</param-value>
        </init-param>
    </filter>
    
    <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages  -->
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>

    <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.)  -->
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>*.jsf</url-pattern>
    </filter-mapping>


    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>
            /WEB-INF/faces-config.xml
        </param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
        <param-value>true</param-value>
    </context-param>

	<!-- Rich Faces  -->    
    <context-param>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>blueSky</param-value>
    </context-param>
    
    <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>    

    <!-- Listener, that does all the startup work (configuration, init). -->
    
    <listener>
        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>
    
    <!-- Faces Servlet
         Marty Hall: changed .jsf back to standard of .faces -->
    <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>

    <!-- Welcome files -->
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

em tempos… se alguem tiver um projeto demo com essas tecnologias integradas e puder me enviar seria muito util, tb…

aceito sugestões de alteração na escolha das imp e versoes

6 Respostas

maurenginaldo

Fiz um projeto utilizando essas tecnologias e não tive problema.
Segue meu web.xml para vc dar uma olhada:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	version="2.4">
	<description>Controle Custo</description>
	<context-param>
		<param-name>com.sun.faces.verifyObjects</param-name>
		<param-value>false</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.STATE_SAVING_METHOD</param-name>
		<param-value>server</param-value>
	</context-param>
	<context-param>
		<param-name>org.richfaces.SKIN</param-name>
		<param-value>blueSky</param-value>
	</context-param>
	
	<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>

	<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>

	<!-- Extensions Filter -->
	<filter>
		<filter-name>extensionsFilter</filter-name>
		<filter-class>
			org.apache.myfaces.component.html.util.ExtensionsFilter
		</filter-class>
		<init-param>
			<param-name>uploadMaxFileSize</param-name>
			<param-value>100m</param-value>
		</init-param>
		<init-param>
			<param-name>uploadThresholdSize</param-name>
			<param-value>100k</param-value>
		</init-param>
	</filter>

	<!-- Filter Mappings -->
	<filter-mapping>
		<filter-name>extensionsFilter</filter-name>
		<url-pattern>*.jsp</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>extensionsFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>extensionsFilter</filter-name>
		<url-pattern>/faces/*</url-pattern>
	</filter-mapping>
	<!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.)  -->
	<filter-mapping>
		<filter-name>extensionsFilter</filter-name>
		<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>extensionsFilter</filter-name>
		<servlet-name>Faces Servlet</servlet-name>
	</filter-mapping>

	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>

	<session-config>
		<session-timeout>30</session-timeout>
	</session-config>

</web-app>
Leozin

No fundo não há mais necessidade de se usar o MyFaces Implementation… não há mais diferença pro RI da Sun, então o mais “sugerível” é você ficar com RI 1.2 (Sun) + Tomahawk… Daí tudo bem =)

Ps.: Isso tudo funciona, mas depende do application server :stuck_out_tongue: no OC4J tive problemas sérios, mas no tomcat 6 e JBoss 4.2.0 tava tudo super sussegado, combinação perfeita, o que um não tem o outro complementa ;D

ld50

maurenginaldo:
Fiz um projeto utilizando essas tecnologias e não tive problema.
Segue meu web.xml para vc dar uma olhada:

que container vc tava utilizando ?
Tomcat 5, 6 ou Jboss ?

vc teria um war vazio, só com as configs e as libs ?

desde ja agradeço

A

Estou tentando rodar MyFaces 1.1.12 (com Facelets) e o Tomahawk no Tomcat 5.5 e não consigo fazer funcionar. Será que tem algo errado ou realmente não roda nesta versão do container?? Não aparece nenhum erro, apenas a tag do tomahawk (dataList) não renderiza na página.

maurenginaldo

Tomcat 5.5 e alguns exemplos Tomcat 6

ld50

testei com o JSF-RI-1.2 da sun e tive o mesmo problema…

alguem poderia me dar um empurrãozinho ?

vou descrever melhor o que esta ocorrendo.

Exemplo 1:

&lt;a4j:commandLink  action="acao" /&gt;

quando tenho esse tipo de situação o commandLink redireciona para a pagina indicada no meu faces-config porem a pagina eh carregada totalmente sem css. se ao inves de utilizar a4j:commandLink utilizar t:commandLink tudo funciona perfeitamente.

Exemplo 2:

&lt;t:div rendered="#{Bean.visivel}"&gt;
 &lt;a4j:commandLink action="#{Bean.acao}" /&gt;
 &lt;t:commandLink action="#{Bean.acao}" /&gt;
&lt;/t:div&gt;

toda vez que eu tenho uma tag com o atributo rendered, qualquer outro componente dentro dela para de executar a ação… ou seja, não chama meu metodo do bean.

estou ficando louco… :shock: :shock:

nao sei mais o que fazer, ja tentei mudar do myFaces pro RI, ja tentei mudar de JSF 1, pra JSF 2 e nada…

alguem tem ideia do que pode estar acontecendo ?

Criado 20 de fevereiro de 2008
Ultima resposta 22 de fev. de 2008
Respostas 6
Participantes 4