Pessoal, preciso da ajuda de vcs. sou iniciante em desenvolvimento web com JSF e estou com o seguinte problema:
criei uma aplicação simples, apenas para testar a logica de funcionamento do JSF.
tenho um FORM com o botão submit, que ao ser clicado teria que chamar um determinado metodo e redireionar para a proxima pagina, mas isso não está acontecendo.
traz a seguinte mensagem de erro:
An Error Occurred:
javax.el.PropertyNotFoundException: /olamundo.xhtml @13,65 action="#{testeBean.salvar}": Target Unreachable, identifier 'testeBean' resolved to null
+ Stack Trace
+ Component Tree
+ Scoped Variables
vou colocar a classe, os xhtml, o xml e os jars q uso pra se alguem poder me ajudar:
vou colocar aqui os jars que coloquei no projeto:
commons-beanutils-1.8.3
commons-collections-3.2.1
commons-digester-2.1
commons-logging-1.1.1
jsf-api
jsf-impl
jstl-api-1.2
jstl-impl-1.2
vejam aí:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>TesteJSF</display-name>
<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>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
classe TesteBean
package bean;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean(name="testeBean")
@RequestScoped
public class TesteBean {
private int i;
public int getI() {
return i;
}
public void setI(int i) {
this.i = i;
}
public String salvar(){
this.i =1;
if(this.i == 1){
return "sucesso-de-repasse";
}else{
return "erro-de-repasse";
}
}
}
pagina inicial
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Teste inicial</title>
</h:head>
<h:body>
<h:form>
<h:panelGrid>
<h:outputLabel value="Teste qualquer"/>
<h:commandButton action="#{testeBean.salvar}" value="executar"/>
</h:panelGrid>
</h:form>
</h:body>
</html>
pagina que deveria aparecer de nome sucesso-de-repasse.xhtml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Teste inicial</title>
</h:head>
<h:body>
<h:outputText value="JSF Sucesso"/>
</h:body>
</html>