Skip to main content

[webtier] JSF2 Simple Example Problem

3 replies [Last post]
Anonymous

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:

Simple Backing Bean

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.
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rockhopper
Offline
Joined: 2003-06-20
Points: 0

Is that a f:view tag? You don't need it.

The JSF 2 spec said f:view too to this tag ;)

Ryan Lubke

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:

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">
.
.
.

> 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:
>
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
> > > 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"> > contentType="text/html" /> > content="text/html; /> Simple Backing Bean
>
> prependId="false"> > value="#{simple.text}"/> > value="submit"/>

>
> 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
> r*oot cause
> *
> javax.el.PropertyNotFoundException: /simple.xhtml @16,62
> value="#{simple.text}": Target Unreachable, identifier 'simple'
> resolved to null
>
> What's wrong?
>
> Thanks in advance.

[att1.html]

Paulo Cesar Reis

Hi, thanks for the answer.

Yes, im using the correct version in my faces-config:
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:

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"> JSF
2.0 SCRAP
JSF 2.0 SCRAP

javax.faces.STATE_SAVING_METHOD server

javax.faces.DEFAULT_SUFFIX .xhtml

facelets.DEVELOPMENT true

com.sun.faces.validateXml true

Faces Servlet
javax.faces.webapp.FacesServlet
1

Faces Servlet
*.jsf

Thanks.

On 4/7/09 2:09 PM, "Ryan Lubke" 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:
>
> >
> 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"
> > onfig_2_0.xsd>
> version="2.0">
> .
> .
> .
>
>

>
>> 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:
>>
>> >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>> > >> 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"> >> />

>>
>>

>>
>>
>> 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.
>
>

[att1.html]