struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: localized html options labels
Date Tue, 28 Aug 2001 00:33:47 GMT

On Sun, 26 Aug 2001 wrote:

> Date: Sun, 26 Aug 2001 17:31:11 -0400
> From:
> Reply-To:
> To:
> Subject: localized html options labels
> Is there a "proper" Struts way of implementing localized html options
> labels?
> I need to display a form that has a select list of provinces/states.
> Dependent on the user's locale, I need it to display, for
> instance, "British Columbia" vs. "Colombie-Britannique".
> A quick perusal of seems to indicate that it is not
> locale sensitive. I also searched the archives and saw a couple of
> similar questions posted, but no answers. Am I missing something
> obvious?
> I can think of a few cheezy/ugly ways of implementing this behavior,
> but wanted to check here first.
> Thanks in advance

This might still qualify as "sorta cheezy", but the basic idea in the
<html:options> tag is that you have two parallel lists - one for the
values (i.e. what weill be returned to the server for this field) and one
for the labels (i.e. what the user sees in the combo box.  The challenge
is to select the *labels* in a locale-sensitive way, without modifying the

What I've typically done is had my Action do this - it creates an
ArrayList or array under a request attribute named "values" for the values
part, and then builds a corresponding ArrayList or array under "labels"
that does MessageResource lookups based on the user's locale.


View raw message