• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

avoid cut and paste in struts validation file

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, ive a struts validation file where i've lots of inputs on my form (types are double). I've got validation on each of these fields but the validation mask is the exact same, i.e. it's:

^[0-9]{1,3}(,?[0-9]{3})*\.?([0-9]{1,2})?$

the file validation for one of the fields is below:

<field property="salary" depends="minlength">
<arg0 key="daily.mappingCheck.record.field41"/>
<arg1 key="${var:minlength}" name="minlength" resource="false"/>
<var><var-name>minlength</var-name><var-value>0</var-value></var>
<var><var-name>mask</var-name>
<var-value>^[0-9]{1,3}(,?[0-9]{3})*\.?([0-9]{1,2})?$</var-value>
</var>
</field>

Is there a handy way in struts i can define this globally instead of having to repeat this string in numerous places?

thanks, Ronan
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes.

You can do it like this:

[ October 13, 2006: Message edited by: Merrill Higginson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic