At line 23 changed 1 line. |
This is how I see how a DOB (for example) date where we want the user to enter a time in hours, minutes, and seconds: |
This is how you could implement date handling using Struts / AppFuse. The example |
uses a DOB where we want the user to enter a time in hours, minutes, and seconds: |
At line 25 changed 2 lines. |
In the POJO, your date is likely to be a java.util.Date or java.sql.Timestamp... you |
have a method called getDOB() which returns a java.util.Date (for example) in your POJO.... |
In the POJO, your date is likely to be a java.util.Date or java.sql.Timestamp... |
so you have a method called getDOB() which returns a java.util.Date (for this example). |
At line 28 changed 1 line. |
When, in your action, you convert your POJO to the form, the converters (statically initialised in the BaseAction), are setup to convert the Date(s) to Strings in your form. |
When, in your action, you convert your POJO to the form, the converters |
(statically initialised in the BaseAction), are setup to convert the Date(s) |
to Strings in your form. |
At line 51 changed 1 line. |
Also note: the datePattern does not work if you try and apply dd/MM/yyyy HH:mm - this is not so much of a problem, as it is not particularly user friendly to make the user input this long string freetext anyhow... so it is best to allow the user to enter hours and minutes using drop downs (populated from the StartupListener)... (BTW - a datePattern of just HH:mm does not seem to work either, so freetext entry of hours and minutes is awkward unless someone writes a custom validator)... |
Also note: the datePattern does not work if you try and apply dd/MM/yyyy HH:mm - |
this is not so much of a problem, as it is not particularly user friendly to make |
the user input this long string freetext anyhow... so it is best to allow the user |
to enter hours and minutes using drop downs (populated from the StartupListener)... |
At line 59 added 3 lines. |
(BTW - a datePattern of just HH:mm does not seem to work either, so freetext entry of hours |
and minutes is awkward unless someone writes a custom validator)... |
|
At line 63 changed 1 line. |
So you have applied the datePattern to the user input field (dateStr), and a String is set on your form (in your chosen dateFormat), and the hours, minutes and seconds are set from the drop downs. |
So you have applied the datePattern to the user input field (dateStr), and a String is |
set on your form (in your chosen dateFormat), and the hours, minutes and seconds are set |
from the drop downs. |
At line 87 changed 1 line. |
Q) What happens if you have 2 dates in your form, and they have different datePatterns?</P> |
Q) What happens if you have 2 dates in your form, and they have different datePatterns? |