That would probably need to be handled via a converter, not a validator.

Dave

--- On Wed, 11/5/08, Lyallex <[EMAIL PROTECTED]> wrote:

> From: Lyallex <[EMAIL PROTECTED]>
> Subject: Handling Integer overflows
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Date: Wednesday, November 5, 2008, 10:59 AM
> Hi
> 
> Please be aware that I understand completely WHY the
> following is
> happening (Integer overflow)
> This question is about how to handle it.
> 
> I have a form that has an input field
> 
> <s:textfield name="creditcount"/>
> 
> In my action I have the fiollowing field
> 
> public Integer creditcount;
> 
> If I enter the String "2147482647" (equivalent to
> Integer.MAX_VALUE)
> then this is converted into the Integer 2147482647 as
> expected.
> 
> If I enter the String "4294967298" this is
> converted to the Integer 2
> (Like I say, I understand why this is happening)
> 
> What I need to happen is that if the String contains a
> value that is
> out of range I don't even want the creditcount field in
> the action to
> be set.
> 
> I have written a custom validator but it appears that the
> value is set
> on the action before this gets called.
> 
> Is there some way I can 'intercept' this String and
> ignore it (i.e
> don't even set the action field) if it is going to
> cause an overflow.
> 
> Thanks
> Lyallex
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]

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

Reply via email to