Jakarta commons validator question

Discussion in 'Java' started by eddiethomas@gmail.com, Dec 14, 2004.

  1. Guest

    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.
     
    , Dec 14, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. FGB

    Jakarta Commons CLI

    FGB, Aug 6, 2003, in forum: Java
    Replies:
    0
    Views:
    555
  2. GaryM
    Replies:
    0
    Views:
    379
    GaryM
    Dec 31, 2003
  3. Replies:
    0
    Views:
    420
  4. bb
    Replies:
    1
    Views:
    2,485
    glVertex
    Feb 7, 2012
  5. Marc Beckers

    Jakarta Commons Validator:

    Marc Beckers, Jul 27, 2006, in forum: Java
    Replies:
    0
    Views:
    437
    Marc Beckers
    Jul 27, 2006
Loading...

Share This Page