Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes i18n and values for a select - how to store and ensure display order? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "i18n and values for a select - how to store and ensure display order?" Watch "i18n and values for a select - how to store and ensure display order?" New topic
Author

i18n and values for a select - how to store and ensure display order?

André-John Mas
Ranch Hand

Joined: Oct 18, 2008
Posts: 37
I am developing a JSP, which needs to support localisation and need to have a select list display values in a specific order. I had looked into using ResourceBundle, since that allows me to find the file according to the locale supplied by the user, but I am unable to use it as a parameter for a JSTL select. I then looked at using a properties file, but the order of the entries in the file is ignored.

I imagine I am not the first person to have this need, so I would be curious what solution there is? Something already in the API, a third-party library or something else?

Edit: Note I am using this in conjunction with Struts2 and JDK 1.5, if that makes a difference.
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
Hi There..,

The locale parameter is not an attribute which you might be able to pass into a JSTL tag, and that is true.
But since you are using Struts here, you might want to try it using <html:select> and <htmlptions> which would take in
the locale information also [optional parameter], and hence could come to your help. In short, try replacing your JSTL tags
for localization, with the struts HTML tags.

Dawn.
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

What Dawn said... Use Struts 2 select tag.


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
Yes, did you try it ?
 
 
subject: i18n and values for a select - how to store and ensure display order?