Re: [appfuse-user] Spring mvc + date validation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [appfuse-user] Spring mvc + date validation

Matt Raible-3
Did you get this solved?  I noticed your comment on the following blog
entry, so it seems like you might've found a solution?

http://jroller.com/page/raible?anchor=validating_dates_with_commons_validator

Matt

On 6/29/05, Radim Burget <[hidden email]> wrote:

> Thanks for your reply. I am totaly desperate about this.
>
> Here is error messages:
> --- Birth is not a date.
> --- Create Date is not a date.
>
> Here is short version. Full xml file shoul be downloaded here:
> http://radone.php5.cz/validation.xml
>
> Short version:
>       <form name="customer">
>               <field property="address1"
>                      depends="required">
>
>                   <arg0 key="customer.address1"/>
>               </field>
>               <field property="idNumber"
>                      depends="required">
>
>                   <arg0 key="customer.idNumber"/>
>               </field>
>               <field property="birth"
>                      depends="required,date">
>
>                   <arg0 key="customer.birth"/>
>                   <var>
>                     <var-name>datePattern</var-name>
>                     <var-value>yyyy/MM/dd</var-value>
>                   </var>
>               </field>
>               <field property="createDate"
>                      depends="required,date">
>
>                   <arg0 key="customer.createDate"/>
>                   <var>
>                     <var-name>datePattern</var-name>
>                     <var-value>yyyy/MM/dd</var-value>
>                   </var>
>               </field>
>               <field property="ident1"
>                      depends="required">
>
>                   <arg0 key="customer.ident1"/>
>               </field>
>               <field property="ident2"
>                      depends="required">
>
>                   <arg0 key="customer.ident2"/>
>               </field>
>               <field property="nameFirst"
>                      depends="required">
>
>                   <arg0 key="customer.nameFirst"/>
>               </field>
>               <field property="nameLast"
>                      depends="required">
>
>                   <arg0 key="customer.nameLast"/>
>               </field>
>       </form>
>
> Matt Raible wrote:
>
> >Can you post your generated validation.xml file?
> >
> >Matt
> >
> >On 6/28/05, Radim Burget <[hidden email]> wrote:
> >
> >
> >>Hi,
> >>could anyone please help me how to handle Date validation in spring-mvc?
> >>
> >>Here my try:
> >>
> >>1] ##### Here is xdoclet tags in my  model class: ####
> >>    /**
> >>     * @param birth The birth to set.
> >>     * @spring.validator type="required"
> >>     * @spring.validator-var name="datePattern" value="yyyy/MM/dd"
> >>     * @spring.validator type="date"
> >>     */
> >>    public void setBirth(Date birth) {
> >>        this.birth = birth;
> >>    }
> >>##########################
> >>2]  in BaseFormController I have added:
> >>       SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
> >>       dateFormat.setLenient(false);
> >>       binder.registerCustomEditor(java.sql.Date.class, new
> >>CustomDateEditor(dateFormat, true));
> >>       binder.registerCustomEditor(java.util.Date.class, new
> >>CustomDateEditor(dateFormat, true));
> >>       binder.registerCustomEditor(java.sql.Timestamp.class, new
> >>CustomDateEditor(dateFormat, true));
> >>###########################
> >>in ApplicationResources.properties added :
> >>
> >>typeMismatch.java.util.Date={0} is not a date in the form 'yyyy/MM/dd'.
> >>typeMismatch.int={0} must be a number.
> >>typeMismatch.java.lang.Integer={0} must be a number.
> >>
> >>###########################
> >>Problem is - when I submit data: "2003/02/01" it is thrown exception
> >>"Birth is not a date."
> >>
> >>Any hel willl be very appreciated.
> >>
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [hidden email]
> >>For additional commands, e-mail: [hidden email]
> >>
> >>
> >>
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [hidden email]
> >For additional commands, e-mail: [hidden email]
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]