Thanks for replying Jeff.

Well as the article suggested I added the Validator interface to the
BaseFieldTag.java class, via the below code:
    Object pagebean = pageContext.findAttribute(name);
    if(pagebean instanceof com.bank.Validator) {
        ((com.bank.Validator) pagebean).setPattern(property, pattern);
        ((com.bank.Validator) pagebean).setErrorMessage(property,
errorMessage);
    }

This compiled, and along with the Validator interface I than create a new
struts.jar file, and it proved the example worked - but it felt so wrong,
almost suicidal (in programming terms :)

I have managed to get around this by using my own custom tags library (i.e.
my:text and my:password - which extend of html:text and html:password) . But
it's fortunate I'm only worried about textBox components, otherwise lack of
multiple inheritance in java would also have got me.

All I'm basically saying is that maybe there should be more than one
validation scheme in the struts architecture - a simple one ("for dummies"
like me :) and a more complicated one, which can be used by those companies
with a big piggy bank.

D.A.V.

P.S. I'm a big fan of intelligent users providing intelligent input, but my
boss is very anti user intelligence :)



> I'm curious as to what change you had to make to the struts source code?
>
> I certainly haven't had to do that, although I thought it was pretty
> slick to be able to extend the framework by providing your own rules...
>
> The XML can be a little verbose, but to quote a Dire Straits song,
> you don't get 'your money for nothin' and chicks for free'...
>
> http://www.ada.com.tr/~modabasi/dslyr6.htm#8
>
> I  guess if you didn't want to 'clutter your XML', you could just
> rely on the user to provide valid inputs :)
>
> -jeff
>
> On Tuesday, March 18, 2003, at 09:43  PM, David Vittor wrote:
>
> > Dear Struts World,
> >
> > Hi! My name is David, and I'm writing to make a formal announcement
> > about the validation package in the struts architecture.
> >
> > Based on this article: Strut your Stuff
> > http://www.javaworld.com/javaworld/jw-12-2000/jw-1201-struts_p.html
> > it comes up with a very good architecture to do validation (although
> > I18N would be nice also). Still a simple regular expresion attribute
> > and an error message is nice. However I found that to implement it - a
> > change to the struts source code is required!!! (This is sooo WRONG!!)
> >
> > But as the struts architecture is only at a Candidate Release, I was
> > wondering if along with the <validation:javascript> tag,  the html tag
> > library could produce something simple (like something not requiring
> > 10 lines of xml for every single fields input?) It's totally
> > unmaintainable.
> >
> > Can anyone help me?
> >
> > D.A.V.
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to