Normally values go from JSP as String. Parse it using Date Formatter and
convert it to Date yourself :)

I have very interesting experiences with this.

On Sat, Nov 28, 2009 at 12:05 AM, ben_979 <benninesevenn...@yahoo.ca> wrote:

>
> Carl, if I could bother you for a few more details?
>
> I like your solution, it seems elegant (to me at least!). I'm trying to
> implement it, but I'm not getting the results that you are.
>
> I've set up the type converter, and I've verified that it is being invoked.
>
>
> When my conversion fails (for example, I just type random strings into the
> date field of my form), the converter is invoked, and the date conversion
> fails (which is correct). However, when I look in the logs, I see that it
> is
> trying to invoke a set method for my date field with a String value as the
> parameter ( setDateTime(String) ) which I don't have, because dateTime is
> expected to be of type Date.
>
> If I enter a date in the proper format, everything works as expected.
>
>
> From the jsp:
> <s:textfield name="schedule.dateTime"
> value="%{getText('detail.date',{schedule.dateTime})}" label="Date/Time"/>
> //detail.date is for formatting
>
> From the validation.xml
> <field name="schedule.dateTime">
>  <field-validator type="conversion" short-circuit="true">
>    <message> Try another format </message>
>  </field-validator>
> </field>
>
>
>
> Thanks in advance, if you have a chance to respond.
>
> --
> View this message in context:
> http://old.nabble.com/Validation-and-conversion-conflict---best-method--tp26341189p26545367.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Saeed Iqbal
http://www.iqbalconsulting.com
Struts - J2EE - Application Architect / Developer

Reply via email to