aspose file tools*
The moose likes Struts and the fly likes Passing a string array in var-value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passing a string array in var-value" Watch "Passing a string array in var-value" New topic
Author

Passing a string array in var-value

Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
I've tried google but can't seem to find anything on this.

Is it possible to pass a string array in <var-value>. For example something like this (though this doesn't work).


I want to check if any of the fields I'm passing is filled in. And if so they must all be filled in. I can do seperate checks on each one but then I get mutliple(redundant) error messages, so I'd like to pass the array and loop through it in my validator-rules.xml, therefore only having one standard error message if any of them fail.

Hope this makes sense.

Thanks
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
In general, if I have validation that is slightly complex I just implement the validate method and write it in Java. Be sure to call super.validate.

The validator framework actually calls get methods on your ActionForm, correct? Maybe you could add a getMailingFields method to your form that returns an empty string if any of the fields are empty and then create a validation rule on mailingFields.

If you are using Dynamic forms, then this may not apply.

- Brent
 
Consider Paul's rocket mass heater.
 
subject: Passing a string array in var-value