Here is what happens when you use a ValueBinding like that:

MyFaces checks the request, session, and application maps for a bean
named "manageProfileFace".  If it is in any of those, it returns it,
if not, it creates it and returns it.
MyFaces checks the "manageProfileFace" for a "bioHelper" property
(specifically for a getBioHelper() method).
MyFaces calls the getBioHelper() method
MyFaces checks the object returned from getBioHelper() for getSpouse()
MyFaces calls getSpouse()
MyFaces checks the object returned from getSpouse() for getFirstName()
MyFaces calls getFirstName()
The value from getFirstName() is what is passed to the outputText.


Essentially, you can think of it as the following java code:
manageProfileFace.getBioHelper().getSpouse().getFirstName();

If getSpouse() returns null, it is obvious why a NullPointerException
would be thrown.


On Tue, 18 Jan 2005 12:15:04 -0500, Srikanth Madarapu
<[EMAIL PROTECTED]> wrote:
> Hi
> 
>   I have the following line in my jsp...
> 
> <h:outputText id="spouse" 
> value="#{manageProfileFace.bioHelper.spouse.firstName}"/>
> 
> The object "spouse" is null. But I am not getting a NullPointerException !! 
> Why? Does the JSF handle nulls and does not throw an exception ? What happens 
> in case if the method returns a boolean ? For example..
> 
> <h:outputText id="spouse" 
> value="#{manageProfileFace.bioHelper.spouse.exists}"/>
> 
> In my situation isExists is always returning false if  "spouse" is null.
> 
> Please help
> 
> TIA.
> -Srikanth Madarapu
> 
> 


-- 
-Heath Borders-Wing
[EMAIL PROTECTED]

Reply via email to