You may want to read on http://struts.apache.org/2.x/docs/type-conversion.html

The last topic "Type Conversion Error Handling".

I had the same problem. It turns out that there's no "validation" concept of a "type" (similar to Struts1"), however Struts 2 will give you control over type conversion problems (similar approach, but with more control).

So, you really don't have to do much (other than formatting the message if the default doesn't suit your needs)


Arpan Debroy wrote:
Thank you Laurie ,

Using 'Long' is the correct way to get 'required' validator worked.
But now I want show error message when user will put string or character
instead of any long value.
What validator to use?

On Dec 11, 2007 7:13 PM, Laurie Harper <[EMAIL PROTECTED]> wrote:

The 'requiredstring' validator will check for both not-null and
not-empty, where 'required' only checks for non-null. If you're using a
numeric primitive type (i.e. 'long' rather than 'Long'), you can never
have a null value, so required can never fail. In that case, you need to
specify range constraints in your validation, or switch to using the
wrapper type instead of primitives.

L.

Arpan Debroy wrote:
Yeah..I am using numbers only.The "required" validator not working for
numbers also.
If you want you can test it quickly.

On Dec 10, 2007 11:01 PM, Jiang, Jane (NIH/NCI) [C] <
[EMAIL PROTECTED]>
wrote:

Use "required" validator only when a field contains a number.  Use
requiredstring for String based field.

-----Original Message-----
From: Arpan Debroy [mailto:[EMAIL PROTECTED]
Sent: Monday, December 10, 2007 11:00 AM
To: Struts Users Mailing List
Subject: Re: Required validator dosen't work

Yeah,
I am using following -
<interceptor-ref name="validationWorkflowStack"/>

Other validators are working.
Anyway have anyone ever used "required" validator or can you use it now
once
to test.

Thanks

On Dec 10, 2007 5:26 PM, Simon Berger <[EMAIL PROTECTED]> wrote:

Do you have the Validation Interceptor on your Stack?

Arpan Debroy schrieb:
I want to validate -

1) The text box should have some value("required" validator doesn't
show
any
error message even if it's empty)..
2) The text box must have any numerical(I am using long data type)
value. I
have no clue how to do it for long.

Can anyone please help..

Thanks



On Dec 6, 2007 1:50 AM, Dave Newton <[EMAIL PROTECTED]> wrote:


--- xniit2003 <[EMAIL PROTECTED]> wrote:

I am trying to use "required" validator in struts2.
But it seems this one dosen't  work at all.
Have anybody successfully used "required" validator.

What data type are you attempting to validate?

d.



---------------------------------------------------------------------
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]


--
Thanks & Regards
 Arpan Debroy

AOL Online India Private Ltd
RMZ EcoSpace Campus 1A
Outer Ring Road, Bellandur,
Bangalore - 560037
India
Mobile No :+9886006306
on-board :+91 (80) 4035 4528
E-mail : [EMAIL PROTECTED]

---------------------------------------------------------------------
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]





--

Alberto A. Flores
http://www.linkedin.com/in/aflores


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

Reply via email to