Galera, abaixo segue um código básico com os seguintes xml’s do JSF:
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>backingFacet</managed-bean-name>
<managed-bean-class>BackingFacet</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>
Default.jsp
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ 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 XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:outputText binding="#{backingFacet.txtOlaMundo}" />
</f:view>
</body>
</html>
BackingFacet.java
import javax.faces.component.UIOutput;
import javax.faces.component.html.HtmlInputText;
public class BackingFacet {
private UIOutput txtOlaMundo = new HtmlInputText();
public BackingFacet(){
txtOlaMundo.setValue("Ola mundo!");
}
public UIOutput getTxtOlaMundo() {
return txtOlaMundo;
}
public void setTxtOlaMundo(UIOutput val) {
this.txtOlaMundo = val;
}
}
Pois bem, abaixo o resultado:
La no final do stackTrace nota-se que ele não está conseguindo instanciar o meu BackingFacet, mas porque!? 8O