arcanum_jp’s blog

おっさんの日記

DatePickerメモ

HTML側

普通にinputタグでいい

<input type="text" class="span2" wicket:id="paydate" />

Pageクラス側


DateTextField型で宣言して、とでDatePickerインスタンスをadd()する。Date型はいつも悩むけどjava.util.Dateね。

DateTextField _paydate = new DateTextField(
                                       "paydate", 
                                       new Model<Date>(new Date()), 
                                       new StyleDateConverter("M-", true)
);

 ・・・省略


 _paydate.add(new DatePicker());

 ※ Wicket1.58時点では、DatePickerは「Joda - Time」に依存しているようです。

Joda-Time provides a quality replacement for the Java date and time classes. The design allows for multiple calendar systems, while still providing a simple API. The 'default' calendar is the ISO8601 standard which is used by XML. The Gregorian, Julian, Buddhist, Coptic, Ethiopic and Islamic systems are also included, and we welcome further additions. Supporting classes include time zone, duration, format and parsing.

Joda-Time - Java date and time API - Home

Joda-Time provides a library of classes to replace the Java JDK Date and Time classes including formatting. It is based around the ISO8601 datetime standard, but also provides full support for other calendar systems, such as Gregorian and Buddhist.>

Joda - Time download | SourceForge.net