posted 17 years ago
This may be possible using the built-in validation, but I am not sure if I would trust it. You have to consider that you may have a user who uses a different format than you are hoping for... 2/1/2007 means Feb. 1, 2007 to me, but Jan. 2, 2007 to some. IIUC, Struts2 will attempt to make a "best guess" as to which date format the user will be entering, but IMO, that may not be enough. Whenever I've dealt with dates in the past, I'll make a set of dropdowns which name the month by their proper name, then a separate input for the day and a dropdown for the year. It is more work for the user entering the date, but it is cleaner for me to handle. If you were dealing with the dates as three separate input fields, you could fairly trivially create an expression that tests that the end date comes after the start date.
-W
Discussion of Java, Struts, Spring, Hibernate, etc. <a href="http://www.wantii.com" target="_blank" rel="nofollow">www.wantii.com</a>