webtier@glassfish.java.net

Re: [webtier] JSF2 Simple Example Problem

From: Paulo Cesar Reis <casmeiron_at_gmail.com>
Date: Tue, 07 Apr 2009 14:31:03 -0300

Hi, thanks for the answer.

Yes, im using the correct version in my faces-config:
<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_2_0.xsd"
version="2.0">
I really don¹t know what is going on, I tried to increase the log details
(to FINEST) but I wasn¹t able to track the error.

And also, follow my web.xml example:

<web-app version="2.5" 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-app_2_5.xsd"> <display-name>JSF
2.0 SCRAP</display-name> <description>JSF 2.0 SCRAP</description>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value> </context-param> <context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value> </context-param> <context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value> </context-param> <context-param>
<description> </description>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value> </context-param> <!-- Faces Servlet
--> <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> </web-app>
Thanks.


On 4/7/09 2:09 PM, "Ryan Lubke" <Ryan.Lubke_at_Sun.COM> wrote:

> On 4/7/09 7:20 AM, Paulo Cesar Silva Reis wrote:
>
> If your application contains WEB-INF/faces-config.xml, make sure the
> faces-config is versioned 2.0:
>
> <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
> <http://java.sun.com/xml/ns/javaee>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> <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_2_0.xsd"
> <http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-facesc
> onfig_2_0.xsd>
> version="2.0">
> .
> .
> .
>
> </faces-config>
>
>> JSF2 Simple Example Problem 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"
>> <http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22> > <html
>> xmlns="http://www.w3.org/1999/xhtml <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; />
>> <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.
>
>