• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Error

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Being totally new to JSF, I am working on some examples.

I have first one from the JSF core 3rd edition and I got the error which I cannot trace.
Error below

/index.xhtml @15,55 value="#{user.name}": Target Unreachable, identifier 'user' resolved to null



Index.xhtml


welcome page

Bean Page


Any help would be appreciated,where to look for an error
Thanks,
Chris
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You have to define the name for the UserBean in faces-config.xml file ,Then only you can use like "user.userName".

Like this:

<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>userBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>


here specifiy the beanclass with your package name if you have any thing like com. - - -.---.U serBean

try some sample applications also and see where to add the config file and all.
 
Saloon Keeper
Posts: 28469
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Chris!

Which version of JSF are you running under?

The annotations only work under JSF2, which is still pretty new. For the JSF 1.x versions, you have to do like Siva says and define the name/bean mapping in the faces-config.xml file.
 
Chris Skalski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim,

Actually, I purchased a book with JSF 2.0 (Core JSF 3rd Edition) and tried couple examples.
The code compiles (I use Netbeans) but when I entered the values on the web page I got this error message.
I contacted the author but so far no help.

I do most of my stuff in jsp/servlet and looking into JSF framwork; but as you said JSF 2 is very new, I might looking into JSF 1.2.
There are more examples for it.

In your opinion, will a transition from JSF 1.2 to 2.0 be difficult ?

Chris

 
Tim Holloway
Saloon Keeper
Posts: 28469
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Skalski wrote:Tim,

In your opinion, will a transition from JSF 1.2 to 2.0 be difficult ?



In my experience, no. Although I'm still in early stages on that.
 
Chris Skalski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim,
I will look into 1.2 as there are not many good references for greenhorns in 2.0
Regards,
Chris
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Skalski wrote:Thanks Tim,
I will look into 1.2 as there are not many good references for greenhorns in 2.0
Regards,
Chris



Chris,
Use @ManagedBean(name="user") instead of @Named("user")
 
Look! It's Leonardo da Vinci! And he brought a tiny ad!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic