Ugh.

I've got a List<Integer> parameter. Let's say it looks like this:

    private List<Integer> foo;
    public List<Integer> getFoo() { return fool; }
    public void setFoo(List<integer> foo) { this.foo = foo; }

So in my form on the client side I've got several <input> tags named "foo"
; that is, their "name" property is "foo".

The answer to whether I'm using Stripes input tags is at best "sort of".
Maybe there's something I don't know about Stripes form tags, but I'm not
sure that would make much difference here.

So the form posts, and the HTTP parameter list includes several "foo=xxx"
parameters. One of them is not a valid integer.

The ScopedLocalizeableError that's created tells me that the error is
related to the form parameter called "foo". It does not indicate in any way
I can find that it's the third "foo" or the seventh "foo" or the tenth; it
just says "this error is about the parameter 'foo'".

Does that clear it up? It seems like a pretty basic issue: does the
validation cycle have a way to indicate exactly which member of a list of
like-named parameter values was the cause of a validation error?

On Mon, Jul 17, 2017 at 6:22 PM Rick Grashel <rgras...@gmail.com> wrote:

> Hi Mike,
>
> Is there any code you can share?  It is really difficult to help here
> without some code.  But first, I guess we should first start with the
> obvious question: "Are you using Stripes form tags?"  Secondly, the
> validation errors object should not just have the foo parameter.  It should
> have the nested property within it.  So the field name should be "foo.bar".
>
> Thanks.
>
> -- Rick
>
> On Mon, Jul 17, 2017 at 6:15 PM, Mike McNally <emmecin...@gmail.com>
> wrote:
>
>> Looping through the errors won't do me any good. The error object just
>> has the name of the List<Foo> parameter, which is shared by all the
>> elements. Which one has the error? How will I have my UI indicate to the
>> user which input in the form has a bad value?
>>
>> I should also note that the value field of the error is wrong; it
>> contains a value from *one* of the fields, but not the bad one.
>>
>>
>> On Mon, Jul 17, 2017 at 6:12 PM Rick Grashel <rgras...@gmail.com> wrote:
>>
>>> Hi Mike,
>>>
>>> So are you saying that after Stripes performs its validation, you want
>>> to interrogate (from within the ActionBean) to see what validation errors
>>> (if any) occurred?
>>>
>>> If so, then you can have a method which is annotated with @After(
>>> LifecycleStage.CustomValidation ).  In that method, you can call
>>> getContext().getValidationErrors() and loop through each error (which will
>>> have the field inside of it if it is a field-level error).
>>>
>>> Is that what you are wanting?
>>>
>>> Thanks.
>>>
>>> -- Rick
>>>
>>> On Mon, Jul 17, 2017 at 5:50 PM, Mike McNally <emmecin...@gmail.com>
>>> wrote:
>>>
>>>> First, still on Stripes 5.something.
>>>>
>>>> In actions with List<Foo> arguments, it seems that validation errors
>>>> are produced (as far as I can tell) such that it's not possible to
>>>> determine which of the parameter values in the list (that is, which of the
>>>> HTTP parameters matching the list name) was the one with the problem, or
>>>> whether multiple inputs had problems, etc.
>>>>
>>>> Is there something I'm missing, or is that just something that Stripes
>>>> just sort of doesn't do?
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>> _______________________________________________
>>>> Stripes-users mailing list
>>>> Stripes-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>>>
>>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Stripes-users mailing list
>>> Stripes-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Stripes-users mailing list
>> Stripes-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to