Olá, pessoal!
Estou tentando a testar rodar JSF bem basicamente para entender como funciona no eclipse.
Eu configurei e coloquei na biblioteca.
Biblioteca jsf-api.jar e jsf-impl.jar na mojarra versão 2.1.1, tomcat 7 em versão jsf 2.0, jstl-api.jar na versão 1.2.1.
as configuração do web.xml
<web-app xmlns:xsi="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_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>TesteJSFWeb</display-name>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<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>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
</web-app>
no bean TextBean.jar
@ManagedBean(name = "textoBean")
@RequestScoped
public class TextoBean {
private String texto;
public String getTexto() {
return texto;
}
public void setTexto(String texto) {
this.texto = texto;
}
}
index.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Ajax com JSF 2.0</title>
</h:head>
<h:body>
<h:form id="form1">
<h:outputScript name="jsf.js" library="javax.faces" target="head" />
<h:outputLabel>Digite seu texto aqui:</h:outputLabel>
<h:inputText id="texto" value="#{textoBean.texto}">
<f:ajax event="keyup" execute="form1:texto" render="form1:resultado" />
</h:inputText>
<br />
Resultado:
<strong> <h:outputLabel id="resultado"
value="#{textoBean.texto}" />
</strong>
</h:form>
</h:body>
</html>
É mais simples para testar a rodar ver se funciona no JSF. quando executar e apareceu uma página inteiro branco. mas o link da página http://localhost:8090/TesteJSFWeb/ apareceu (porta que eu alterei no tomcat).
Será que eu fiz alguma configuração errada. Espero que me dá dicas ou corrigir esse erro, obrigado!