I am assuming you are using session to store data and the data in the setters require a valid bean pulled from the session.
Based on the action states the order in which the methods are called. For example the constructor is not called the first time the POJF is run, however the second pass does. Also if you are submitting form data then the execute will only run once the data has been processed. See the following for a basic stack trace of calls based on actions.
Call Stack
## First Time Run ##
execute()
getTodayDate()
getTodayDate()
getTomorrowDate()
getTomorrowDate()
getBirthDate()
getBirthDate()
getDesc()
## Second Pass ##
DateBeanAction()
setSession(Map session)
execute()
getTodayDate()
getTodayDate()
getTomorrowDate()
getTomorrowDate()
getBirthDate()
getBirthDate()
getDesc()
## Submit ##
DateBeanAction()
setSession(Map session)
setBirthDate(Object birthDate)
setTodayDate(Object value)
setTomorrowDate(Object value)
setDesc(String desc)
execute()
getTodayDate()
getTodayDate()
getTomorrowDate()
getTomorrowDate()
getBirthDate()
getBirthDate()
getDesc()
It is impossible to change the format
We have to differentiate between the over the wire format and the browser's presentation format.
Wire format
The HTML5 date input specification refers to the RFC 3339 specification, which specifies a full-date format equal to: yyyy-mm-dd
. See section 5.6 of the RFC 3339 specification for more details.
This format is used by the value
HTML attribute and DOM property and is the one used when doing an ordinary form submission.
Presentation format
Browsers are unrestricted in how they present a date input. At the time of writing Chrome, Edge, Firefox, and Opera have date support (see here). They all display a date picker and format the text in the input field.
Desktop devices
For Chrome, Firefox, and Opera, the formatting of the input field's text is based on the browser's language setting. For Edge, it is based on the Windows language setting. Sadly, all web browsers ignore the date formatting configured in the operating system. To me this is very strange behaviour, and something to consider when using this input type. For example, Dutch users that have their operating system or browser language set to en-us
will be shown 01/30/2019
instead of the format they are accustomed to: 30-01-2019
.
Internet Explorer 9, 10, and 11 display a text input field with the wire format.
Mobile devices
Specifically for Chrome on Android, the formatting is based on the Android display language. I suspect that the same is true for other browsers, though I've not been able to verify this.
Best Solution
You shouldn't need the square brackets.
would render the following html
This should populate the 'sentdate' List of your Action.