aspose file tools
The moose likes JSF and the fly likes Condition check in using rendered Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Condition check in using rendered" Watch "Condition check in using rendered" New topic
Author

Condition check in using rendered

Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 10
Hi

I have basic question.

I am displaying all the values of output. I am using the below tag to display date. Whenever the date is null, it is throwing null pointer exception. I tried to use rendered to fix this. But didn't work out. Please correct my code and help me.

<hutputText id="begindate" value="#{beanInstance.beginDate}" rendered="#{! empty beanInstance.beginDate}">
<f:convertDateTime pattern="MM/dd/yyyy"/>
</hutputText>

When i change rendered ="#{false}". Its working. whenever database value for beginDate is not null it is working.

Thanks
Pardha
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14491
    
    7

Try 'rendered="#{! (empty beanInstance.beginDate)}"'.


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

Joined: Mar 11, 2010
Posts: 10
No Luck. Same result -- Null pointer exception whenever beanInstance.beginDate is null from DB.

Thanks
Pardha
Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 10
Can someone reply for my earlier post.

Thanks
Pardha
Jagadeeswara Yaramala
Ranch Hand

Joined: Jul 28, 2010
Posts: 46
Try this:

1) rendered="#{!(beanInstance.beginDate==null)}"

or

2) rendered="#{!(beanInstance.beginDate=='null')}" /* This is because null is a reserved literal in Java */

I think you should check for null which is for reference variables like Date.

Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 10
Both the options not working.

Thanks
Pardha
Liangfeng Ren
Greenhorn

Joined: Jul 28, 2010
Posts: 7
Hi, probably need you to provide the error log to see where the nullpointexception was thrown from.


Thanks
Liangfeng
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Condition check in using rendered
 
Similar Threads
Problem displaying desired output
retrieve a int from backbean and dinamically work with it in the .xhtml in very bizarre way
Sortable DataTable in WebSphere portal
Data Iterator Table
File browser button