This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about rendered attribute
 
Similar Threads
How CheckNotNull works
[URLyBird]Why not come in and debate on my code of find?
presentation layer in JSF
Override h:message renderer
Evaluating 2 expressions in JSF using JSTL if tag