If i'm guessing correctly, you're currently trying to validate the PAGE_SIZE
property of a java.lang.String. This is incorrect.
ValidateNestedProperties is used to validate sub properties of an object (if
indexed, the ? in List<?>, if mapped the ? in Map<someKey, ?>).
Christian
________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Newman, John W
Sent: Tuesday, August 19, 2008 11:41 AM
To: Stripes Users List
Subject: Re: [Stripes-users] maps and @ValidateNestedProperties
"but adds validation errors under the key preferences.PAGE_SIZE instead of the
expected preferences[PAGE_SIZE]."
I noticed this the other day - I sent an email to the list about it but got no
response. Is that the correct behavior? Without the index in the error's
field name, the widget can't get the error css. Why aren't error field names
and the widget names a one to one match when using indexed properties?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Levi Hoogenberg
Sent: Tuesday, August 19, 2008 2:27 AM
To: Stripes Users List
Subject: Re: [Stripes-users] maps and @ValidateNestedProperties
Followup: Stripes does process the validation annotations, but adds validation
errors under the key preferences.PAGE_SIZE instead of the expected
preferences[PAGE_SIZE].
On Mon, Aug 18, 2008 at 10:38 PM, Levi Hoogenberg <[EMAIL
PROTECTED]<mailto:[EMAIL PROTECTED]>> wrote:
Hi,
today I've been binding into a Map for the first time using Stripes and I must
say it was much less painful than I feared :) Now I'm trying to validate the
map's contents by using something like:
@ValidateNestedProperties({
@Validate(field = "PAGE_SIZE", required = true)
})
private Map<Preference, String> preferences;
Preference is an enum. This doesn't seem to work - is it supposed to work (and
if so, how?), or is this use so rare that it's not supported? I've looked
through the source code and I can't find any code that seems to deal with this,
but then again, that part of Stripes is quite complex, IMO.
Another quick question: I'm using clean URLs (who doesn't nowadays, thanks Ben)
and one of my parameters is an enum value (a PreferenceCategory to be exact).
Now the EnumeratedTypeConverter only understands the actual name() of enum
constants. Since I write my constants in upper case, I'd end up with URLs like
/members/preferences/DISPLAY, if I would use the default enumerated type
converter. To avoid this, I subclassed the type converter. Now for the (not so
quick anymore) question: would a hook in EnumeratedTypeConverter to tweak the
input that would get sent to Enum.valueOf make sense, or would it be
unnecessary since the user would be subclassing the type converter anyway?
Another option would be to abstract this naming conversion into an interface so
that the formatter could use it too (eg. for generating URLs), but that's just
me thinking out loud.
Levi
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users