Fred,

It's not about web apps or server apps. It's about key/value pairs.
You can't duplicate keys in a properties file any more than you can
duplicate keys in a map or indexes in an array. You need to either use
unique keys (e.g., prefixes as Eric suggested) or use separate
properties files.

- Isaac

On Tue, Jan 6, 2009 at 9:32 AM, Fred Janon <[email protected]> wrote:
> That's what I ended up doing, but it's such a common thing in Web
> client/server apps that I thought someone would have done something to solve
> the issue without doing that.
>
> Thanks
>
> Fred
>
> On Tue, Jan 6, 2009 at 21:31, Eric Ayers <[email protected]> wrote:
>>
>> Umm, couldn't you copy the map you got from the Constants class into a
>> second Map and strip off the prefix .*_ from your keys?  You'd need to be
>> consistent in your naming, but one small method could do this.
>>
>> On Tue, Jan 6, 2009 at 6:11 AM, Fred Janon <[email protected]> wrote:
>>>
>>> Hi Eric,
>>>
>>> I understand each property must be unique, but I want to end up with
>>> different selects with a different name with the same values for their
>>> options for the submission to the servIer.
>>>
>>> <SELECT name="category">
>>>       <OPTION value="1">entertainment</OPTION>
>>>       <OPTION selected='selected' value="2">sports</OPTION>
>>> </SELECT>
>>> <SELECT name="eventtype">
>>>       <OPTION value="1">Concert</OPTION>
>>>       <OPTION selected='selected' value="2">Parade</OPTION>
>>> </SELECT>
>>>
>>> I need to internationalize "entertainment", sports, etc...
>>>
>>> With your solution I would end up with
>>>
>>> <SELECT name="category">
>>>       <OPTION value="category_1">entertainment</OPTION>
>>>       <OPTION selected='selected' value="category_2">sports</OPTION>
>>> </SELECT>
>>> <SELECT name="eventtype">
>>>       <OPTION value="eventtype_1">Concert</OPTION>
>>>       <OPTION selected='selected' value="eventtype_2">Parade</OPTION>
>>> </SELECT>
>>>
>>> The values are the DB keys, unique within their domain, but not unique
>>> across all the domain classes.
>>>
>>> Thanks
>>>
>>> Fred
>>>
>>> On Mon, Jan 5, 2009 at 22:31, Eric Ayers <[email protected]> wrote:
>>>>
>>>> I hope you've worked through this by now, but the problem you're seeing
>>>> is because each property key needs to be unique. You need to name your
>>>> properties differently, such as:
>>>>
>>>> EVENTTYPE_1 = concert
>>>>
>>>> EVENTTYPE_2 = parade
>>>>
>>>> CATEGORY_1 = entertainment
>>>>
>>>> CATEGORY_2 = sports
>>>>
>>>> CATEGORY_3 = arts
>>>>
>>>> CATEGORY_4 = services
>>>>
>>>> EVENTTYPES=EVENTTYPE_1, EVENTTYPE_2
>>>>
>>>> CATEGORIES=CATEGORY_1,CATEGORY_2,CATEGORY_3,CATEGORY_4
>>>>
>>>> On Tue, Dec 23, 2008 at 7:09 AM, Fred Janon <[email protected]> wrote:
>>>>>
>>>>> I use several listboxes with a numeric key and a text as the value. I
>>>>> need to internationalize the text. I don't know if there is a way to code
>>>>> that in a property file. I tried the following but all the maps are all
>>>>> mapped with the last values at runtime.
>>>>>
>>>>> Application.properties
>>>>>
>>>>> 1 = concert
>>>>> 2 = parade
>>>>> EVENTTYPES = 1, 2
>>>>>
>>>>> 1 = entertainment
>>>>> 2 = sports
>>>>> 3 = arts
>>>>> 4 = services
>>>>> CATEGORIES = 1, 2, 3, 4
>>>>>
>>>>> Application.java
>>>>> Map EVENTTYPES();
>>>>> Map CATEGORIES();
>>>>>
>>>>> Runtime:
>>>>>
>>>>> [INFO] Event types Key: 1 value: entertainment // Should be "concert"
>>>>> [INFO] Event types Key: 2 value: sports // Should be "parade
>>>>>
>>>>> [INFO] Categories Key: 1 value: entertainment
>>>>> [INFO] Categories Key: 2 value: sports
>>>>> [INFO] Categories Key: 3 value: arts
>>>>> [INFO] Categories Key: 4 value: services
>>>>>
>>>>> Use:
>>>>>
>>>>> Map<String, String> eventtypes =
>>>>> StringManager.Constants().EVENTTYPES();
>>>>> Map<String, String> categories =
>>>>> StringManager.Constants().CATEGORIES();
>>>>>
>>>>> I don't know if there is a way to do that in a properties file.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Fred
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Eric Z. Ayers - GWT Team - Atlanta, GA USA
>>>> http://code.google.com/webtoolkit/
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> Eric Z. Ayers - GWT Team - Atlanta, GA USA
>> http://code.google.com/webtoolkit/
>>
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to