Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error

 
Chris Skalski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
 
siva prasa
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • 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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18156
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
Pie
Posts: 18156
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
fadi aboona
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • 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")
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic