I need to create four radio-buttons each of which should represent a specific date-interval. For instance, here is the piece of markup and the bean:
Bean:
@ManagedBean(name="bean")
public class MyBean{
Date dateFrom;
//GET, SET
}
Markup piece:
<h:selectOneRadio value="#{bean.dateFrom}">
<f:selectItem itemValue="What?" itemLabel="#{msgs['bundleWithTodayLable']}"/>
<f:selectItem itemValue="What?" itemLabel="#{msgs['bundleWithLastWeekLabel']}"/>
<f:selectItem itemValue="What?" itemLabel="#{msgs['bundleWithLastYearLable']}"/>
</h:selectOneRadio>
I need to initialize the dateFrom
property with the begin of today date, begin of the current week and begin of the current year. Is it possible to avoid Java
-style String
to Date
conversions and do it strictly in JSF.
I'm using JSF 1.2
in the porjcet I need to implement that feature.