I am using Struts 2 wich uses the com.opensymphony.xwork2.validator.validators. It does not seem to have a validator to test to see if a a value can be converted to an integer. Is there a way to write my own validator to do this work?
On 7/31/07, Jorge Martín Cuervo <[EMAIL PROTECTED]> wrote: > Hi > > which version of commons validator are you using? > > http://struts.apache.org/1.2.9/userGuide/dev_validator.html > > i so, you can see: > > integer - validates that a field can be converted to an Integer. > > <field property="ordernumber" depends="integer"> > <arg0 key="order.number"/> > </field> > > intRange - validates that an integer field is within a specified range. > Requires min and max variables to specify the range. This validator depends > on the integer validator which must also be in the field's depends attribute. > > <field property="age" depends="required,integer,intRange"> > <arg0 key="employee.age"/> > <arg1 name="intRange" key="${var:min}" resource="false"/> > <arg2 name="intRange" key="${var:max}" resource="false"/> > <var><var-name>min</var-name><var-value>18</var-value></var> > <var><var-name>max</var-name><var-value>65</var-value></var> > </field> > > > integer checks if the field value can be converted into an integer, i didn't > check the code but i supose something like that: > > Integer.parseInt(...) > > maybe you are using intRange instead > > > El lun, 30-07-2007 a las 14:30 -0330, Richard Sayre escribió: > > Is there a way to use the XML validation to check to see if a field is > > a number? I used integer to check for min and max but if I enter any > > text into the field it passes the validation. > > > > Thanks, > > > > Rich > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- > ____________________________________ > Jorge Martin Cuervo > > Outsourcing Emarketplace > deFacto Powered by Standards > > email <[EMAIL PROTECTED]> > voice +34 985 129 820 > voice +34 660 026 384 > ____________________________________ > > > DE FACTO STANDARDS, S.L., le informa que su dirección de correo > electrónico, así como el resto de los datos de carácter personal que > nos facilite, serán objeto de tratamiento automatizado en nuestros > ficheros, con la finalidad del envío de información comercial y/o > personal por vía electrónica. Vd. podrá en cualquier momento ejercer el > derecho de acceso, rectificación, cancelación y oposición en los > términos establecidos en la Ley Orgánica de Protección de Datos de > Carácter Personal (LOPD. 15/1999), dirigiendo un escrito a C/ > Gutiérrez Herrero (Centro De Empresas 'La Curtidora'), 52 - oficina 207 > - 33402 AVILES (Asturias), o a nuestra dirección de correo electrónico > ([EMAIL PROTECTED]). También informamos que la información incluida en > este e-mail es CONFIDENCIAL, siendo para uso exclusivo del destinatario > arriba mencionado. Si Usted lee este mensaje y no es el destinatario > indicado, le informamos que está totalmente prohibida cualquier > utilización, divulgación, distribución y/o reproducción de esta > comunicación sin autorización expresa en virtud de la legislación > vigente. Si ha recibido este mensaje por error, le rogamos nos lo > notifique inmediatamente por esta misma vía y proceda a su eliminación. > > This e-mail contains information that will be added to our computerised > guest data base and will be trated in the strict confidence. If you > wish to access, correct, oppose or cancel your details, as specified > the Law 15/99, December 13th, please send a certified letter to this > effect to DE FACTO STANDARDS, S.L.., (C/ Gutiérrez Herrero (Centro De > Empresas 'La Curtidora'), 52 - oficina 207 33402 AVILES (Asturias) > SPAIN). If you read this message, and is not the destinatary, we > informal you that is forbidden anything utility, distribution, > divulgation or reproduction of this communication without express > authorization, of the present law. If you received this message for > mistake, we proud in order to the present law, immediate communication > to us, and please erase this e-mail > > > --------------------------------------------------------------------- > 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]