commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric.Le...@swissinfo.ch
Subject RE: Validator: Using stand-alone validation fails
Date Wed, 14 Jan 2004 12:05:13 GMT
> Commons Validator doesn't provide any default validation actions.  It only
> provides basic validation methods that any Java code can use (ie. not
> using the XML file at all).  You can call these methods from customized
> validation actions that you configure in XML (Struts does this).

Sorry, I actually meant the default validators that come with Struts.
According to "Programming Jakarta Struts", that should work.
My idea was to use the same validator-rules.xml for both Struts and
stand-alone validation.

> No, you should drop struts.jar from your standalone app and code custom
> validation actions that suit your environment.  Basically, you just need a
> class with methods that invoke EmailValidator.validate() and the like and
> handle error messages.  You then configure your methods in XML.  The
> Struts FieldChecks methods are great examples of how to use Commons
> Validator.

Ok, I'll check them out, thanks!

Eric

-----Original Message-----
From: David Graham [mailto:grahamdavid1980@yahoo.com]
Sent: Dienstag, 13. Januar 2004 14:31
To: Jakarta Commons Users List
Subject: RE: Validator: Using stand-alone validation fails



--- Eric.Lewis@swissinfo.ch wrote:
> Sure, but I was trying to use the Validator's default validation
> methods.

Commons Validator doesn't provide any default validation actions.  It only
provides basic validation methods that any Java code can use (ie. not
using the XML file at all).  You can call these methods from customized
validation actions that you configure in XML (Struts does this).

> You mean I would have to create a pseudo HttpServletRequest for that?

No, you should drop struts.jar from your standalone app and code custom
validation actions that suit your environment.  Basically, you just need a
class with methods that invoke EmailValidator.validate() and the like and
handle error messages.  You then configure your methods in XML.  The
Struts FieldChecks methods are great examples of how to use Commons
Validator.  

David

> 
> Eric
> 
> -----Original Message-----
> From: David Graham [mailto:grahamdavid1980@yahoo.com]
> Sent: Montag, 12. Januar 2004 21:21
> To: Jakarta Commons Users List
> Subject: RE: Validator: Using stand-alone validation fails
> 
> 
> How are you passing it an HttpServletRequest object in a non-web app? 
> Including struts.jar and servlet.jar with a standalone app isn't
> necessary
> if you just implement your own validation method.
> 
> David
> 
> 
> --- Eric.Lewis@swissinfo.ch wrote:
> > Actually, I have the struts.jar in my path, and within
> > org.apache.struts.validator I can see the FieldChecks.class. So why
> > shouldn't I be able to use it? (Sorry if that's a dumb question...)
> > 
> > Eric
> > 
> > -----Original Message-----
> > From: David Graham [mailto:grahamdavid1980@yahoo.com]
> > Sent: Montag, 12. Januar 2004 19:35
> > To: Jakarta Commons Users List
> > Subject: Re: Validator: Using stand-alone validation fails
> > 
> > 
> > It looks like you're trying to use a Struts class
> > org.apache.struts.validator.FieldChecks to run the validation.  You
> need
> > to implement your own validation method and configure it in xml
> similar
> > to
> > FieldChecks.
> > 
> > David
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message