Is there a way to format the date object to be displayed in a select item ?
Here's my example :
<h:selectOneMenu
label="Period"
value="#{myBean.periodStartEndList}"
id="periodStartEnd"
converter="genericConverter">
<f:selectItem itemLabel="Choose one .." noSelectionOption="true" />
<f:selectItems
value="#{myBean.periodStartEndList}"
var="periodStartEnd"
itemValue="#{periodStartEnd}"
itemLabel="#{periodStartEnd.map['dateStart']} -- #{periodStartEnd.map['dateEnd']}" />
</h:selectOneMenu>
And the combo / selection displays these :
Sun May 01 14:57:21 WIT 2011 -- Thu May 05 14:57:21 WIT 2011
Fri May 06 14:57:21 WIT 2011 -- Tue May 10 14:57:21 WIT 2011
I would like to have something simpler like :
01-05-2011 -- 05-05-2011
06-05-2011 -- 10-05-2011
I wonder how to achieve this ?
Thank you !
You create EL function for conversion and use it. Check http://www.javabeat.net/tips/4-expression-language-in-jsp-20.html and http://wiki.apache.org/myfaces/Parameters_In_EL_Functions. Disclaimer: I never used it and don't know if it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With