struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Mefford <paulmeff...@gmail.com>
Subject Validation Help
Date Sun, 17 Jun 2012 18:27:23 GMT
I have a unique problem with a form that I need to support multiple
countries and the possibility of different inputs.  I want to reduce code
duplication per country and have been using validation to help with this.
I used the alias feature to help the internalization since I couldn't find
how xwork loads the validation.xml files to change the locale or make the
xml a resource bundle.  Anyway so I used [Action Class Name]-[Alias as a
part of the alias I included the locale]-validation.xml.  For example lets
say my action is NewCustomer.java so my validation file would be named
NewCustomer-saveCustomerUS-validation.xml.  This would apply my United
States rules to the form.  The action is actually declared with a wild card
in sturts.xml <action name="saveCustomer*" class="NewCustomer">
<result......</result></action>.  In the form the source looks like this
<form action="saveCustomerUS"... > because the jsp know the country to use.

*The Problem*
This was working fine when we were using Java 1.5  we recently upgraded to
Java 1.6 seeing how Java 1.7 is out and we should probably upgrade before
the dust triggers a fire.   When we did the upgrade the alias stopped xwork
from finding the right validation file for each country. What happens is
the first country that is used wins and it doesn't find another validation
file for other countries.  It caches the validation file and doesn't load
another.  I have tried again to find the .xml loader in the framework but
it is very cryptic and deep.  Now we are reduced to the copy paste pattern
in the struts.xml having to define an action for every country.  eg. <action
name="saveCustomerUS" class="NewCustomer">
<result......</result></action> <action
name="saveCustomerMX" class="NewCustomer"> <result......</result></action>.

Can anyone give me some advice on how to fix the .xml loader so it finds a
xml file using the wildcard in sturts.xml?  Or has anyone done this a
different way with validation?

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