Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

javax.el.PropertyNotFoundException:

Estou com problemas para comunicar minha View com meu Bean

Feb 10, 2017 4:42:30 PM com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError SEVERE: javax.el.PropertyNotFoundException: /index.xhtml @19,59 value="#{loginController.usuario.email}": Target Unreachable, identifier 'loginController' resolved to null at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100) at org.primefaces.util.ComponentUtils.getConverter(ComponentUtils.java:144) at org.primefaces.renderkit.InputRenderer.getConvertedValue(InputRenderer.java:171) at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1045) at javax.faces.component.UIInput.validate(UIInput.java:975) at javax.faces.component.UIInput.executeValidate(UIInput.java:1248) at javax.faces.component.UIInput.processValidators(UIInput.java:712) at javax.faces.component.UIForm.processValidators(UIForm.java:253) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261) at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195) at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221) at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:178) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'loginController' resolved to null at com.sun.el.parser.AstValue.getTarget(AstValue.java:84) at com.sun.el.parser.AstValue.getType(AstValue.java:69) at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:194) at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98) ... 33 more

package br.com.fitecproject.controllers;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import br.com.fitecproject.daos.UsuarioDao;
import br.com.fitecproject.models.Usuario;
import br.com.fitecproject.util.Constant;



@Controller
public class LoginController
{    

    @Autowired
    private Usuario usuario = new Usuario();

    @Inject
    UsuarioDao dao;


    public String efetuarLogin(){

        FacesContext context = FacesContext.getCurrentInstance();

        if (dao.consultarUsuario(usuario)) {
            context.getExternalContext().getSessionMap().put(Constant.ID_OBJ_LOGADO, usuario);
            return "home?faces-redirect=true";
        }

        context.getExternalContext().getFlash().setKeepMessages(true);
        context.addMessage(null, new FacesMessage("Usuário não cadastrado"));

        return "index?faces-redirect=true";
    }

    public String efetuarCadastro(){
        System.out.println("Metodo efetuarCadastro");
        return "cadastroUsuario?faces-redirect=true";
    }


    public Usuario getUsuario() {
        return usuario;
    }


    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }



}
<!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:f="http://xmlns.jcp.org/jsf/core"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:p="http://primefaces.org/ui">
<h:head>
    <title>Hello World!</title>
</h:head>


<h:body>
    <div class="ui-g">
        <div class="ui-g-12">

            <h:form id="autor">

                <p:outputLabel value="email:" />
                <p:inputText value="#{loginController.usuario.email}">
                </p:inputText>
                <p:outputLabel value="senha:" />
                <p:password value="#{loginController.usuario.senha}">
                </p:password>

                <p:commandButton actionListener="#{loginController.efetuarLogin}"
                    value="cadastrar" />
                <p:commandButton
                    actionListener="#{loginController.efetuarCadastro}"
                    value="Efetuar Cadastro" />

            </h:form>

        </div>
    </div>
</h:body>
</html>
2 respostas
solução!

É.. alguma coisa deu errado nessa integração com o Spring.. ele não está expondo o seu managedbean na expression language. Já tentou trocar para @ManagedBean ?

Opa Alberrto obrigado por me ajudar, porém já solucionei realizando outra integração, flconfigurei o projeto novamente e conseguir fazer na comunicação... Muito obrigado