struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jitendra" <jitendra_pa...@persistent.co.in>
Subject Struts 2 validation is not working for comma separated number entered in text field which has property type integer
Date Mon, 19 Jan 2009 08:24:24 GMT
Hi,


We are using the struts2.0.6 framework as part of our business application.
Recently we found that there is a validation issue with struts2 frame -
work. Let me explain my problem first. 

In a jsp page, I have defined a s:text field and the field property is
Integer type(defined in bean). Now if I enter the String value in text filed
and submit the form, then the struts2 frame work shows the validation error
for the String value, because the property is of type Integer. This is right
behavior. But if I enter the Integer value with comma separated (i.e. 1,2,3)
in text box and submit the form then the struts2 frame - work stripping out
the commas from that value and submit it to bean and does not throwing any
error.

My question is how I can validate the Integer value which has the commas in
it. Basically, we don't want to add any custom validator for this field
because if we do so then we have to apply this validation through out our
application and it is around 150 places. 

Is there any common place where I can configure? Or Is Struts 2 has any
solution for this? If yes then which struts file (i.e. struts2 code base)
needs to change to apply this validation for the text field which will apply
for all text fields.

 

 

Thanks in advance,

Jitendra


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent
Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed.
If you are not the intended recipient, you are not authorized to read, retain, copy, print,
distribute or use this message. If you have received this communication in error, please notify
the sender and delete all copies of this message. Persistent Systems Ltd. does not accept
any liability for virus infected mails.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message