Hi,
I¹m trying to run the simple example of JSF2 but JSF2 is not finding my
ManagedBean declared using @ManagedBean annotation.
Follow my BackinBean:
@ManagedBean(name="simple") public class SimpleBackingBean { private
String text; @SuppressWarnings("unused") @PostConstruct private
void init( ) { this.setText("initialized"); } public String
getText() { return text; } public void setText(String text) {
this.text = text; } }
Follow my xhtml example:
<!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"
xmlns:composite="
http://java.sun.com/jsf/composite"
xmlns:ez="
http://java.sun.com/jsf/composite/simpleout"
xmlns:ui="
http://java.sun.com/jsf/facelets"> <f:view contentType="text/html"
/> <h:head> <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" /> <title>Simple Backing Bean</title> </h:head>
<h:body> <h:outputText value="#{simple.text}" /><br/> <h:form
prependId="false"> <h:inputText id="text" name="text"
value="#{simple.text}"/> <h:commandButton id="submitText"
value="submit"/> </h:form> </h:body> </html>
I am using glassfishv3 and Mojarra 2.0.0 (PR2 09).
The printed value on outputText is blank and after pressing the Submit I get
an error:
javax.servlet.ServletException: /simple.xhtml @16,62 value="#{simple.text}":
Target Unreachable, identifier 'simple' resolved to null
root cause
javax.el.PropertyNotFoundException: /simple.xhtml @16,62
value="#{simple.text}": Target Unreachable, identifier 'simple' resolved to
null
What¹s wrong?
Thanks in advance.