struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bart Busschots <bart-li...@so-4pt.net>
Subject Validating Arrays
Date Tue, 01 Aug 2006 18:01:23 GMT
Thanks Ed,

I've decided that a simple array is the way to go for me here. It will 
just be an array of Strings, nothing too complex. The validator is 
proving a little more complex to figure out.

So, I have an array of Strings in a form property and I need to be sure 
that each String in that array matches a simple RE (i.e. it only 
consists of a-z, A-Z and space). Can someone give me an example of how 
to do this or a link to a howto?

Before anyone shouts "RTFM" I've tried and the FM doesn't actually tell 
you how to validate arrays. It alludes to the fact that it's possible 
but doesn't tell you how. The best documentation I've been able to find 
on the Validator on the struts site is: 
http://struts.apache.org/1.x/faqs/validator.html

This page is not a full API spec by any means but it does claim to link 
to a full spec at 
http://struts.apache.org/1.x/struts-action/apidocs/org/apache/struts/validator/package-summary.html#package_description

thing is that page gives a 404.

People have complained that the struts page is difficult to extract 
useful information from before and now I'm joining them. I'm not afraid 
to RTFM to figure something out but since I can't even find the manual 
on the Struts site I'm a little stuck. I've tried googling for "struts 
validator array" with no luck. Just some posts on other boards where 
really rude people are telling people to RTFM but not giving a link to 
the FM which seems impossible to find :(

Help!

Bart.



Ed Griebel wrote:
> Lists is where you want to be headed, see answer to previous question
> as to how to do it on JSP. The key is that the Jakarta
> BeanUtils/PropertyUtils classes treat arrays and collections the same
> way so both can use brackets for element indexing. The key is to
> predefine the instance, I think struts will throw an exception if your
> list instance is null.
>
> It doesn't even need to be a LinkedList, as long as it implements List
> (and possibly Collection??).
>
> As to the validator, I'm pretty sure it handles it, just don't know
> off the top of my head how it does it.
>
> -ed
>
> On 8/1/06, Bart Busschots <bart-lists@so-4pt.net> wrote:
>> Following on from my earlier email it strikes me that the most sensible
>> way to deal with collecting a variable number of student names is to
>> have a LinkedList in your form bean. However, the question then is, can
>> Struts handle this? Can the validator handle this? I would need the
>> validator to apply one rule to all elements of a variable length list?
>>
>> I have a feeling I've stumbled into a limitations with Struts here but I
>> could be wrong. So far no amount of googling has helped me out here. If
>> anyone has any pointers on where to look for solutions to this I'd be
>> much obliged. I can't be the first person to want to change the layout
>> of a latter page in a multipage form within struts based on the values
>> submitted in a previous page!
>>
>> Thanks,
>>
>> Bart.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message