File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Java » JSF
Bookmark "h:outputText: Default Value" Watch "h:outputText: Default Value" New topic
Author

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="#{bean.date}"/>. 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) {
this.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:



then


[ 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: http://aspose.com/file-tools
 
subject: h:outputText: Default Value
 
Similar Threads
Nesting ognl expressions?
inputText + inputHelperDatePicker default value problem
onClick() to clear text field
How to set default value in input text box - jsf
Filling a Form based on previous JSP data