You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by j alex <st...@gmail.com> on 2008/10/13 15:49:53 UTC

Executing Action on validation failure.

Hi,
I need to implement an use case where the data needs to be saved in DB, even
though all the submitted form fields aren't valid. The rule is to make those
fields empty and insert whatever is good into the DB (there are  few
non-nillable fields that need to be valid as a prerequisite). I don't want
to throw away all the validation.xml that's been done and resort to manual
validation for this. So, i'm planning to call validate() within the Action ;
check for fielderrors ; make a copy of the entity object - null out every
field that has an error associated with it, and send this entity to the biz
layer, and redirect to INPUT page which will show the form with the original
values populated. I haven't gone into details of implementing the
fielderrors check, but think it's doable. Just wanted to check if there are
any suggestions/best practices for doing this.

Thanks,
Joseph