[Resolvido] Spring + JSF

4 respostas
felipef

Prezados Boa Tarde

Ja procurei em tudo que é forum e ja fiz tudo o que foi proposto nos forums mas nao encontrei o meu problema Tenho os seguintes libs
/Novo/WebRoot/WEB-INF/lib/antlr-3.0.jar
/Novo/WebRoot/WEB-INF/lib/asm-all-2.2.jar
/Novo/WebRoot/WEB-INF/lib/commons-logging.jar
/Novo/WebRoot/WEB-INF/lib/jsf-api.jar
/Novo/WebRoot/WEB-INF/lib/jsf-facelets.jar
/Novo/WebRoot/WEB-INF/lib/jsf-impl.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.aop-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.aspects-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.beans-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.context-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.context.support-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.core-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.expression-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.integration-tests-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.jdbc-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.jms-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.orm-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.transaction-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.web-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/org.springframework.web.servlet-3.0.0.M2.jar
/Novo/WebRoot/WEB-INF/lib/primefaces-3.3.jar
/Novo/WebRoot/WEB-INF/lib/spring.jar

Tenho a seguinte configuração no meu web XML

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 
	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_3_0.xsd">
  <display-name></display-name>	
  <welcome-file-list>
  	<welcome-file>InformarDadosCartao.xhtml</welcome-file>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
  <servlet>  
    <display-name>FacesServlet</display-name>  
    <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>
	<listener>
		<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
	</listener>
</web-app>

Meu applicationContext

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" 
	xmlns:lang="http://www.springframework.org/schema/lang"
	xmlns:util="http://www.springframework.org/schema/util" 
	xmlns:jee="http://www.springframework.org/schema/jee"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation=
						"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           				 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           				 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
           				 http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.0.xsd
                         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
                         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
                         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
    default-autowire="byName">


      <context:component-scan base-package="br.com.facade"/>
	  <context:annotation-config />

</beans>

Anotei uma classe com @Controller, mas quando ela é invocada por um botão em um xhtml dá o seguinte erro

javax.el.PropertyNotFoundException: /InformarDadosCartao.xhtml @20,124 value="#{informarDadosCartaoFacade.dadosCartao.tipoCredito}": Target Unreachable, identifier 'informarDadosCartaoFacade' resolved to null

Aleguem tem alguma ideia do que to fazendo de errado?:??

4 Respostas

Hebert_Coelho

Coloca seu mb apenas os imports e a declaração da classe aí.

informarDadosCartaoFacade

felipef
import java.io.FileNotFoundException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;

import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import br.com.transacaoTef.DadosCartao;
import br.com.transacaoTef.TransacaoTef;
import br.com.util.BaseAction;

@Controller
@Scope("session")
public class InformarDadosCartaoFacade extends BaseAction {

	private static final long serialVersionUID = 5763960044897057833L;

Seria isso ou precisa de mais alguma coisa???

giovannicandido

Já configurou o jsf para procurar por spring beans?

no arquivo faces-config.xml (para jsf 2.0)

org.springframework.web.jsf.el.SpringBeanFacesELResolver
felipef

Obrigado pessoal pela ajuda

FUncionou

Utilizei as libs
antlr-3.0.jar
asm-all-2.2.jar
aspectjrt.jar
axis-ant.jar
axis.jar
commons-codec-1.6.jar
commons-logging.jar
javax.faces-2.1.9.jar
org.springframework.aop-3.0.0.M2.jar
org.springframework.aspects-3.0.0.M2.jar
org.springframework.beans-3.0.0.M2.jar
org.springframework.context-3.0.0.M2.jar
org.springframework.context.support-3.0.0.M2.jar
org.springframework.core-3.0.0.M2.jar
org.springframework.expression-3.0.0.M2.jar
org.springframework.integration-tests-3.0.0.M2.jar
org.springframework.jdbc-3.0.0.M2.jar
org.springframework.jms-3.0.0.M2.jar
org.springframework.orm-3.0.0.M2.jar
org.springframework.transaction-3.0.0.M2.jar
org.springframework.web-3.0.0.M2.jar
org.springframework.web.servlet-3.0.0.M2.jar
primefaces-3.3.jar
spring.jar

e o faces-config ficou assim

<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xi="http://www.w3.org/2001/XInclude"
 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">
 
 <application>
   <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> 
 </application>
 
</faces-config>

Obrigado

Criado 11 de junho de 2012
Ultima resposta 11 de jun. de 2012
Respostas 4
Participantes 3