Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Jakarta commons validator question

Reply
Thread Tools

Jakarta commons validator question

 
 
eddiethomas@gmail.com
Guest
Posts: n/a
 
      12-14-2004
I have been using the Jakarta Commons Validator (without Struts) for a
project at work and I think its awesome. Here's my problem. I have
multiple "forms" where the fields are disributed in different pages. So
for example, in "form1" the firstName field is in page 1. In "form2"
the first name field is in page 5. We can validate this by creating two
<form> elements in the validation.xml file and changing the page
attribute in the <field> tag.

Doesn't this tie the actual logic of validating the fields to the
presentation/view? This pretty much means that if I move fields around
from one page to the other I am forced to duplicate the <form> tag with
a new mapping and change the page attribute.

Instead of doing that, why don't we create another constructor for the
Validator class that takes a List of fields to be validated. That way
the "action" (or the servlet that proceses the request) can read the
fields that were submitted from the request and validate only those
fields. The advantage of this approach would be, everytime fields are
moved around, our validation.xml file does not need to change. We just
focus on creating the JSP (or whatever) page and not worry about the
validations. Of course, we do need to ensure that the request paramater
names match the field name. The disadvantage of this approach is that,
we are only validating those fields that are being submitted. So when
you submit page 3, only page 3 is validated, not page 1 and 2.

I'm willing to contribute to the commons source code but before I do
that, I wanted to know if my thought process is flawed or if I am
missing something. I looked at the TODO list in the Commons Validator
and didn't find anything that matches what I am looking for.
Thanks,
Eddie.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Jakarta Commons-Validator config. problem bb Java 1 02-07-2012 04:24 AM
Jakarta Commons Validator: Marc Beckers Java 0 07-27-2006 08:13 AM
Jakarta commons validator question eddiethomas@gmail.com Java 0 12-14-2004 10:51 PM
Anyone using Jakarta Commons DBCP? GaryM Java 0 12-31-2003 03:29 PM
Jakarta Commons CLI FGB Java 0 08-06-2003 02:53 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57