This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JSF and the fly likes h:outputText: Default Value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "h:outputText: Default Value" Watch "h:outputText: Default Value" New topic

h:outputText: Default Value

Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240
Hi All, I have a text field that is used to present a date like:
<h utputText value="#{}"/>. What I want to do is, if the bean date is null, I want a default text to show up for example "month/day/year" in the field. What is the easiest way to accomplish this. My backing Bean is something like:

class Bean {
Date date;
public Date getDate() {
return date;

public void setDate(Date date) { = date;

Thanks in advance.

Never be satisfied with anything less than the best and you will surely pass the test...
Rick Beaver
Ranch Hand

Joined: Dec 14, 2004
Posts: 464
I would do:


[ October 12, 2005: Message edited by: Rick Beaver ]

ph34r my 133t j4v4 h4><0r1ng sk177z
Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240
Thanks for the solution.
I agree. Here's the link:
subject: h:outputText: Default Value
It's not a secret anymore!