File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes delayed validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "delayed validation" Watch "delayed validation" New topic

delayed validation

Adam Queens

Joined: Dec 03, 2008
Posts: 1
I am working on multi-page form (wizzard) application usign Struts 1.2.9. User goes from let's say page 1 -> page 2 -> page 3 and then on page 4 we show him/her summary of all the information that they entered on the previous pages.

When the user is presented any of the pages I want to validate the infomation that they entered and show them the error message if they left a require field blank. But if the user wants to continue they can submit the form again without fixing the problem and the next form is displayed. On the summary page I display all of thier errors and make them fix the errors/blank required fields etc. before they submit the final/summary page.

This is very similar to your tax prepration application where if you do not know required information you can continue and fix it later. Anybody knows how to do that in struts because it seems like validator only has required and not required attributes?
David Newton

Joined: Sep 29, 2008
Posts: 12617

If it's a single session-based ActionForm it might be easier to do the validation manually rather than through XML. One solution for the XML route is to use the validwhen (or whatever it's called) and check both the condition and a per-page token, but I tend to think this would be brittle and too irritating to maintain.

Doing the validation in Java, in a validate method that dispatches to a per-page validation method based on a page token is an option to keep in mind, anyway.
I agree. Here's the link:
subject: delayed validation
It's not a secret anymore!