File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Unclear on what's happening with validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Unclear on what Watch "Unclear on what New topic
Author

Unclear on what's happening with validation

Rex Norm
Ranch Hand

Joined: Dec 11, 2010
Posts: 41
I use Struts 1.3.10.

I have a form where users add data-entry rows and fill out data about an order item. Rows can be added or deleted.
I've defined an OrderForm (a bean, extends ValidatorActionForm) that has an ArrayList of OrderItem beans. The idea is that as rows of order items are added by the user, the ArrayList<OrderItem> captures them.

The form works well, but, when I run with validation, I get bizarre behavior:

- if a user submits a blank row or sets of fields, validation works. But if the user decides to delete that row and resubmit, the validation behaves as if the row were still present and kicks out a validation asking for field values. Even if I add a row, I can't get out of this loop... I have to logout and restart a new session to enter data.

It seems that the ActionForm is out of sync with the UI. I've tried placing the form in session scope and request scope... same problem.

Any idea what is going on? My impression is that a new form should be submitted, but it's acting like the old one is.

I think I'm unclear on the order of operations for validation-- is it:
1.) instantiate bean
2.) run validator
3.) if validator passes, then process to the next Action
4.) if validator fails, then kick back to prior jsp?

Would implementing the .reset() method help?

thanks in advance.

_R
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Unclear on what's happening with validation