You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Winterfeldt <dw...@yahoo.com> on 2001/07/18 21:55:42 UTC

Managing validator.xml sIze ( was Server Side Validation not firing for Validator when Java Script is off)

As the size of the validators have gotten larger 
(especially with the JavaScript) I've thought about
whether it is better to do an xml include or have a
separate xml file.  So then there could be a
validation.xml and validator.xml (the first would have
the form info and the second would have the validator
definitions with JavaScript).  If it was a separate
file, you could make it part of your build process to
include it in your war so there wouldn't be as much
cutting and pasting.  Or another alternative is that
if it is a separate file it could load it as a
resource from the classpath and you could override it
by setting a location for the file in the
ValidatorServlet.  Although I'm not sure if loading it
from the classpath makes it less accessible and is a
good thing or a bad thing.  Any comments or
suggestions for a better way to handle this?

David

--- Scott Ryan <sc...@efirstbank.com> wrote:
[snip]
> Once question I have for those developing enterprise
> applications is
> how to managed the validation.xml file.  It seems
> that is contains
> application specific information as well as
> enterprise specific
> information.
> 
> It seems that the file contains javascript
> validation code which could
> be used throughout the enterprise on a number of
> applications. It also
> contains validation rules specific to the
> application that you are
> deploying.  It seems that you either have to
> duplicate the javascript
> code to deploy in multiple validation.xml files or
> you have to include
> the validation rules for all applications in every
> validation.xml file. 
> I realize you can cut and paste but this opens up
> possibilities for
> making mistakes.  
> 
> Has anyone come up with a way to package the inline
> javascript so it
> can be used in multiple validation.xml files and you
> only have to change
> one file to add additional javascript functions.
> 
> 
> 
> Scott Ryan
> Developer
> First Bank Data Corporation
> Work: (303) 235-1485
> Cell:    (303 263-3044
> 
> >>> dwinterfeldt@yahoo.com 07/18/01 10:06AM >>>
> The JavaScript part shouldn't have anything to do
> with
> the server side other than it uses the same object
> in
> application scope.  Does the name attribute of your
> action (which matches the key the ActionForm is
> stored
> under) in the struts-config.xml the same as the form
> element's name attribute?  
> 
>     <action    path="/registration"
>               
>
type="com.wintecinc.struts.example.validator.RegistrationAction"
>                name="registrationForm"
>                scope="request"
>                validate="true"
>                input="/registration.jsp">
>        <forward name="success"             
> path="/index.jsp"/>
>     </action>
> 
>       <form    name="registrationForm">
>       </form>
> 
> David
> 
> --- Scott Ryan <sc...@efirstbank.com> wrote:
> > Yes I am extending ValidatorForm instead of
> > ActionForm.  Did you mean
> > ValidateForm or ValidatorForm.  
> > 
> > I originally commented out the validate method
> that
> > I had but after
> > nothing happened I tried creating a validate
> method
> > that only called
> > super.validate with the proper attributes but it
> > returned an empty
> > errors object.  
> > 
> > It almost appears that I have missed a flag
> > somewhere.  It was easy to
> > get the client side to work but unlike the rest of
> > the user's I am
> > having a problem getting the server side to fire
> > correctly.  
> > 
> > I am going to try and remove the onsubmit from my
> > jsp and see if the
> > server side will fire then.
> > 
> > Thanks for your suggestions.
> > 
> > Scott Ryan
> > Developer
> > First Bank Data Corporation
> > Work: (303) 235-1485
> > Cell:    (303 263-3044
> > 
> > >>> rcornia@dced.state.ut.us 07/18/01 08:50AM >>>
> > Are you extending ValidateForm instead of
> > ActionForm?
> > 
> > If you have a validate method in your form, be
> sure
> > to call
> > super.validate().
> > 
> > Ryan
> > 
> > 
> > 
> > >>> scott.ryan@efirstbank.com 07/18/01 08:53AM >>>
> > I am trying to use the Validator extension for
> > struts.   I have the
> > client side functioning correctly and it works
> > great.  I then go into
> > Netscape and turn off java script and the server
> > side checking is not
> > firing.  Am I missing some configuration
> parameter? 
> > I even tried
> > calling super.validate from a validate method
> within
> > my ActionForm and
> > this returned no information either.  Any ideas on
> > where I can look?
> > 
> > Thanks
> > 
> > Scott Ryan
> > Developer
> > First Bank Data Corporation
> > Work: (303) 235-1485
> > Cell:    (303 263-3044
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/