Thanks for thanking ;)

I was wondering if anyone took a closer look at the example, and if
anyone has any comments.

I kind of forgot to explain my goals behind the framework. I do not like
the available validation frameworks because in those frameworks you have
to put type information etc. in a configuration file. Moreover, to keep
the error reporting working, you should use 'flat' forms with string
fields. Now, what I achieved in this framework is that:

1) You have standard typechecking and error reporting build in. If you
need an integer field, just declare it as an integer property in your
form. If user input is not valid for an integer, an error is recorded,
the original input value is saved as an override (in order to show the
user the value he or she submitted).

2) The ability to use 'deeper' forms (hmm, my English is lousy at
times... Sorry). E.g., you can have a form like this:

public class EditCDForm extends AbstractForm 
{
        private Long someId;

        private CD cd = new CD(); 
        // create empty instance to be able to populate it from the
request 
  ...

And HTML fields like this:

<input type="text" name="cd.title">

So, no need to construct the object anymore, as you allready have it in
your form. You could do:

Long newId = (Long)session.save(form.getCD()); // make persistent with
Hibernate

Besides, this gives you better structuring options, especially where you
reuse forms for different purposes.

3) Multi-line handling. In my form I could have:

private Double[] trackLength;

And in my html form I could have:

<input name="trackLength" size="10"> <!-- field one -->
<input name="trackLength" size="10"> <!-- field two -->
<input name="trackLength" size="10"> <!-- field three -->

That should result in having my form populated with an array of three
doubles for field trackLength. If you look at the complete example, you
can see that the error reporting knows about these fields as well; if
you give invallid input for field two, there will be a saved error and a
saved override value for that field. It's a pitty that multilines only
work for flatt fields, but that's HTML...


As a final note, I do not:
1) Worry about javascript validation (which seems to be the key focus of
Jakarta Commons Validator). When I write webapps, I try to avoid
javascript as much as I can. Imho, you need to focus on the server side
validation anyway, and if you really need to write some javascript, you
better just write it and keep it visible (I *hate* all the JSP tags that
generate fancy stuff for you... makes it much harder to debug)
2) Take extra model information (like maximum field sizes etc) into
account. It's pretty easy to do by overriding

protected boolean validateForm(ControllerContext ctx, AbstractForm
formBean) 

from AbstractCtrl. And if you want to do this automatically, I think you
want to do this at a central place (like a custom hibernate mapping
file).


Regards,

Eelco

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Valeri
Sarantchouk
Sent: vrijdag 25 juli 2003 17:18
To: [EMAIL PROTECTED]
Subject: RE: [Mav-user] new user


Eelco,

Fantastic! Thanks for the example!

I agree with Jeff that Maverich doesn't need documentation because it's
simple. It&#8217;s 80/20 rule? 80% of the time you don't need
documentation for Maverick at all :~), but those 20% of rare cases will
make you read source. Just my $0.02.

Struts' online documentation is more targeted at novice inexperienced 
developers, whereas Maverick is for those who tried everything else and
got 
disappointed. This is one of the reasons Struts got so much attention 
(7 books published!) despite the unnecessary complexity and all really
hard time it gives to its adopters.

So Maverick remains a hidden gem in ocean of J2EE application
frameworks.

Regards,

Valeri

---



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
[INVALID FOOTER]

Reply via email to