Foren

JSP Taglib input-date & input-time drawbacks

thumbnail
Jakub Liska, geändert vor 12 Jahren.

JSP Taglib input-date & input-time drawbacks

Regular Member Beiträge: 187 Beitrittsdatum: 25.03.10 Neueste Beiträge
Hey,

I'm just pointing out an idiosyncrasy that wasted quite a lot of my time. If you have ever used JSP input tag for Date type attribute, you'd get a nice html form widget that is otherwise huge pain in the ass.

First of all, it passes Date&Time values as individual request parameters (2011, 11, 2,6,22,1), which is very inconvenient, binding that stuff to a command object, parsing to Date type, etc.

Secondly, based on type of Locale it shows / hides AM/PM html form field, but browser populates request even with value of a hidden field ! so there is default 0 value in http request even if AM/PM doesn't exist for that Locale. And there is 0 / 1 for AM / PM Locales .

Finally, Month select field with option values 0-11 ? Why ? Both DateFormaters, Joda-time's DateTime, etc. all work with 1-12 values

As a result, you spend much more time coding server side for this nonsense than if you code your own date&time widget. Unit testing this or utilizing Selenium / Webdriver for regression testing, you better have no gun around ...

You can see that in these folders :

portal-web/docroot/html/taglib/ui/input_date
portal-web/docroot/html/taglib/ui/input_time