GeeCON Prague 2014*
The moose likes JSF and the fly likes Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Error" Watch "Error" New topic
Author

Error

Chris Skalski
Greenhorn

Joined: Nov 03, 2009
Posts: 3
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

Joined: Feb 16, 2010
Posts: 25

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

Joined: Jun 25, 2001
Posts: 16093
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Chris Skalski
Greenhorn

Joined: Nov 03, 2009
Posts: 3
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

Joined: Jun 25, 2001
Posts: 16093
    
  21

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

Joined: Nov 03, 2009
Posts: 3
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

Joined: Apr 25, 2010
Posts: 71
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")
 
GeeCON Prague 2014
 
subject: Error