This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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 ]
 
A timing clock, fuse wire, high explosives and a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic