You could use a single key with some sort of delimter:

sports.options=Football\Hockey\Badminton

and parse the key to create your options.

Paul

-----Original Message-----
From: Lars Bergström [mailto:[EMAIL PROTECTED]
Sent: 28 August 2003 12:25
To: [EMAIL PROTECTED]
Subject: MessageResource, html:options & i182


Part 1
On a jsp page I want to have a html:select of the type that has a
predefined
number of options, e.g. different sports. Now, I want to make use of
Struts
internalization where the differents locales text strings are retrieved
from
its locale properties file. 

If I read the text strings from the Message resource file one by one
then I
have to edit my java code when I find out that I want another sport in
my
html:select. In my case a new sport is added very seldomly. 

Is there a nice way of using struts tags like logic:iterate together
with
html:select or 
Can I in some nice looking way with the help of MessageResourceBundle
class
retrieve all text strings starting with sports.* ? 

Part 2

Have being doing some thinking and reading,

In chapter 13.4.3 (Struts in Action) I found text talking about exaktly
this.
Still, the "keys" array must be populated in some way. One alternative
is to
have a separate properties file that holds all the keys for different
sports.
Another alternative is to have a database table containing the keys. 

org.apache.scaffold.text.MessageUtils? Whereever did it go? Can't find
it!
Anyone? 

An aspect of this is how often you estimate that the information will be
edited by the end user. If the end user never or almost never add new
sports,
then saving the i18n strings in a Resource files would be alright.
However, if
the end user quite frequently changes the information, perhaps would it
then
be more convenient to store the information in a database since it can
be
viewed more a part of the application rather than a part of the delivery
of
the product. 

Best regards

Lasse Bergström

 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


**************************************
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you are not 
the addressee indicated in this message (or responsible for delivery of the message to 
such person), you may not copy or deliver this message to anyone. In such case, you 
should destroy this message, and notify us immediately. If you or your employer does 
not consent to Internet email messages of this kind, please advise us immediately. 
Opinions, conclusions and other information expressed in this message are not given or 
endorsed by my Company or employer unless otherwise indicated by an authorised 
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted 
via electronic mail attachments we cannot guarantee that attachments do not contain 
computer virus code.  You are therefore strongly advised to undertake anti virus 
checks prior to accessing the attachment to this electronic mail.  Axios Systems Ltd 
grants no warranties regarding performance use or quality of any attachment and 
undertakes no liability for loss or damage howsoever caused.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to