wood burning stoves 2.0*
The moose likes JSF and the fly likes Question about rendered attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Question about rendered attribute" Watch "Question about rendered attribute" New topic
Author

Question about rendered attribute

Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Ok here is the situtation:

Backing Bean



Utility class



JSF page



throws a DateNotFoundException. I dont want this to happen - I want to display "" if the end date is null.

So, I tried



and that didn't work.

How do I go about achieving this without making a change to the checkNotNull() function in my utility class

[ May 21, 2006: Message edited by: Mike Corleone ]

[ May 21, 2006: Message edited by: Mike Corleone ]
[ May 21, 2006: Message edited by: Mike Corleone ]

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
anyone?
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Mike Corleone:
I dont want this to happen - I want to display "" if the end date is null.


So, why are you throwing the exception. Just return an empty string would work I hope.
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
that will work. But i dont want to modify the function in my utility class



as this function is used in several places. any other solution? (apart from adding a new fn to the utility class that does the same check except that it returns "" instead of throwing exception).
g madhava
Ranch Hand

Joined: Sep 14, 2001
Posts: 85
Change the method which you have in the backing bean to the below.

public Date getEnd() {
return someUtiltyClass.checkNotNull(end);
}


Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by g madhava:
Change the method which you have in the backing bean to the below.


Simply.
 
 
subject: Question about rendered attribute