| 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.
<h utputText id="begindate" value="#{beanInstance.beginDate}" rendered="#{! empty beanInstance.beginDate}">
<f:convertDateTime pattern="MM/dd/yyyy"/>
</h utputText>
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
|
|
|
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
|
 |
 |
|
|
subject: Condition check in using rendered
|
|
|