Dear all,
I've been trying to get Dates validation for my
Struts project without any success. I'm using struts 1.2.4 with Validator 1.1.3 on
tomcat 5.0.27.
In my application, I'm having a hier of MappingDispatchAction for Action, where individual action mappings in struts-config map to individual method in the Action class. The form is a child of ValidatorActionForm with a VO bean for holding business data and a
string for holding the value for the date field. The VO bean contains a java.sql.Date field. In the getter and setter of the textual field, I get and set the data from VO bean, so as to have virtually a String-only ActionForm.
I'm pasting relevant codes below
struts-config.xml:
validation.xml:
editDetail.jsp:
Now, everytime I submit the page and if the field is empty it throws me an exception related to beanUtils.populate(). According to my understanding this type of exception should only come when struts copying data into the ActionForm is problamatic. However, it seems to me that the validator is somehow bypassed.
If I remove the copying (to and from the VO bean into the textual date field) code from my ActionForm, it validates things properly.
I'm not sure what is going wrong here and hence I'm seeking the advise here. I've gone throgh all major mailing lists and forums for struts for any hints on this, but could find little. I'm sorry for such a long post, but I wanted include maximum data into the post.
Thanks and regards,
Kinjal Sonpal
[ November 02, 2004: Message edited by: Kinjal Sonpal ]