You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Owen Berry <ow...@gmail.com> on 2009/01/26 19:37:42 UTC

Type conversion errors for collections

I have an action that has a collection of objects. Conversion to and
from the objects in this collection works fine. However, I can't
figure out how to give sensible errors for type conversions that fail.
It's not cool for the user to get:
    Invalid field value for field "deliveryLocations[1].port".

In my action .properties file I can have:
    invalid.fieldvalue.deliveryLocations[0].port=Delivery Location
Port is invalid

This works fine, but I don't want to add 10 of these and then just
hope the user does not enter 11 locations.

Thanks for any suggestions.

Owen

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


Re: Type conversion errors for collections

Posted by Owen Berry <ow...@gmail.com>.
Accidentally found out how to do this:

  invalid.fieldvalue.deliveryLocations[*].port=Delivery Location Port is invalid

Posting it for others who may have the same question.

On Mon, Jan 26, 2009 at 1:37 PM, Owen Berry <ow...@gmail.com> wrote:
> I have an action that has a collection of objects. Conversion to and
> from the objects in this collection works fine. However, I can't
> figure out how to give sensible errors for type conversions that fail.
> It's not cool for the user to get:
>    Invalid field value for field "deliveryLocations[1].port".
>
> In my action .properties file I can have:
>    invalid.fieldvalue.deliveryLocations[0].port=Delivery Location
> Port is invalid
>
> This works fine, but I don't want to add 10 of these and then just
> hope the user does not enter 11 locations.
>
> Thanks for any suggestions.
>
> Owen
>

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