Caroline Jen's question make me think about something. I'm wondering how
other people deal with this particular issue-

Say that you have some sort of i18n'd app, and on a JSP screen for doing
CRUD, you have one or more select boxes. You use html:option tags that
get the labels (and maybe even the values) out of the correct Message
Resource properties file. This gets whatever you need saved into the
database that way in any language you support. Great. No problem.

But - later on some display screen:

You have retrieved the value that had been previously of the select box.
You want to display the corresponding label with a bean:message tag.
It's in the properties file after all. 

So, how do you go about getting the key for the corresponding label to
display? How do you go about divining the key to use to get it out of
your MessageResource file? I mean, if you can't do that, why bother
using the properties file for this in the first place?

The solution would be more obvious if html:options or
html:optionsCollection supported a "key" attribute (how it would be
supposed to work is another good question!).

I see the following ways to go about it.

1) A database lookup for value->MessageResources key, preferably into
some collection in application scope at startup.
2) making the values themselves the MessageResources keys (Gag. Choke.
Wheeze.)
3) Some sort of call to MessageResources or MessageBundle, or an
extension to said classes. <hand waving occurs>

Option 1 seems to be the most palatable if there's a way to do it
without needing to change the code with every message resource addition.
Maybe #3 resulting in #1.

Anyone got an approach they like?



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

Reply via email to