Title: How to set custom locale in java ee?
Tags: java;jakarta-ee;internationalization
Question: I have an application that needs to set locale based on some url parameter.
I tried to set the ResourceBundle like this:
Locale italian = new Locale("it", "IT");
ResourceBundle bundle =
PropertyResourceBundle.getBundle("com.i18n.nl.MyResource",
italian);
sessionBean.setBundle(bundle);
request.getSession().setAttribute(Constants.SESSION_BEAN, sessionBean);
But, as my browser is English, it shows the English locale instead of the italian bundle resources.
Should I do anything else in my .jsp file?

Here is the accepted answer: Yes you need to modify your JSP page to implement locale. Refer this link to implement locale in JSP. Hope it will help.
link 1.
Link 2
Link 3


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2018:00:04/30/18', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<java><jakarta-ee><internationalization>', 'Title': 'How to set custom locale in java ee?', 'ViewCount': 183, 'id': 50101412, 'user_AboutMe': '<p>Partially programmer, partially designer! An WPF lover, Android developer and .Net contributor! Learning more and more everyday :) And happy to help others work!</p>\n', 'user_AccountId': 397001.0, 'user_DisplayName': 'Sonhja', 'user_Reputation': 8025.0, 'user_Views': 1056.0, 'user_id': 760893.0}}