Having shown you a way to do this, let me now tell you why you should not do this.
If you are using internationalization now, or think you ever might start using internationalization with this website, having an option value stored as a message key will mess up your code. The reason being that the value could vary depending on what language is being used. Even though you might want the label in the option to read differently depending on the language of the user, you will want it to return the same value so that the your logic will work the same regardless of what language the client is using.
If you don't want to hard-code these values, I'd suggest you store them in a database table.
Joined: Apr 27, 2006
You're absolutely right, did think about that too. I could just hardcode the option values, but that would give me another problem. In the next pages, the selected value (which I saved in the session) is shown on top of the page. I would like to show the text of the option, instead of the value, which off course is saved in the session. I'm using internationalization so the value should be shown in the proper language. Any thaughts on that?
Joined: May 05, 2006
You should use some type of constants to represent the values. In the update action, use the selected value to map back to the original text.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: bean:message tag in option tag. is there a solution?