Read Date conversion in Struts2, then set a Locale to Struts2 in struts.xml in the following way:
<constant name="struts.locale" value="it_IT" />
with your desired Locale instead of it_IT
, if you are not building a multi-language (i18n) web application.
Also consider using HTML5 native <input type="date" />
, with a fallback (in this case with Modernizr) to jQuery for browsers not supporting that feature:
<script>
// If not native HTML5 support, fallback to jQuery datePicker
$(function(){
if (!Modernizr.inputtypes.date) {
$('input[type=date]').datepicker({
// Consistent format with the HTML5 picker
dateFormat: 'yy-mm-dd'
},
// Localization
$.datepicker.regional['it']
);
}
});
</script>