Ola Galera estou precisando da ajuda de voces.
Estou seguindo uma apostila de jsf e ja no primeiro exemplo estou com problema.
Vamos la
fiz o arquivo ola.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Minha Primeira Aplicação</title>
</head>
<body>
<f:view>
<h:form>
<h:outputLabel value="Seu nome: "/>
<h:inputText value="#{usuarioBean.nome}"/>
<h:commandButton value="Enviar"
actionListener="#{usuarioBean.enviar}"/>
<br/>
<h:outputText value="Bem vindo a primeira aplicação JSF, #{usuarioBean.nome}"
rendered="#{usuarioBean.nome != null}"/>
</h:form>
</f:view>
</body>
</html>
depois fiz o Bean UsuarioBean
package com.algaworks.dwjsf.view;
import javax.faces.event.ActionEvent;
public class UsuarioBean {
private String nome;
public void enviar(ActionEvent event){
this.setNome(this.getNome().toUpperCase());
}
//get
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
}
O Faces config esta assim:
<?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_1_2.xsd"
version="1.2">
<managed-bean>
<managed-bean-name>UsuarioBean</managed-bean-name>
<managed-bean-class>com.algaworks.dwjsf.view.UsuarioBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
Bom quando vou acessar aparece a primeira tela para eu digitar o nome, quando clico em enviar ai aparece este erro:
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
org.apache.jasper.el.JspPropertyNotFoundException: /ola.jsp(14,0) ‘#{usuarioBean.nome}’ Target Unreachable, identifier ‘usuarioBean’ resolved to null
at org.apache.jasper.el.JspValueExpression.getType(JspValueExpression.java:61)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030)
at javax.faces.component.UIInput.validate(UIInput.java:960)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1233)
at javax.faces.component.UIInput.processValidators(UIInput.java:698)
at javax.faces.component.UIForm.processValidators(UIForm.java:253)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1172)
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:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:409)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:636)
Alguem pode me ajudar?