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
MappingActionForm 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:
-------------------------------------------------
<action path="/inquiry/submitDetail" 
        parameter="submitDetail" 
        name="inquiryForm" 
        scope="session" 
        validate="true" 
        input="/pages/inquiry/editDetail.jsp" 
        type="foo.bar.struts.action.InquiryAction">
<forward name="previewDetail"
path="/pages/inquiry/previewDetail.jsp"/>
</action>
--------------------------------------------------

validation.xml: 
--------------------------------------------------
<form name="/inquiry/submitDetail">
        <field property="offerEndDate" depends="required"
page="1">               
<arg0 key="inquiry.form.header.offerEndDate"/>
        </field>
</form>
--------------------------------------------------

editDetail.jsp:
--------------------------------------------------
<html:form action="/inquiry/submitDetail">
        <html:hidden property="page" value="1" />
        <html:text name="inquiryForm" property="offerEndDate"
/>
        ..
        ..
</html:form>
--------------------------------------------------

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



                
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to