Reputation: 105083
How can I use ServletRequest.getLocale()
in JSF application, when Servlet
is absent in my code and is provided by JSF implementation? I'm trying to use ServletContextListener
, but is it possible to reach ServletRequest
from ServletContextEvent
?
Anyway, what is the correct approach?
Upvotes: 3
Views: 5577
Reputation: 80186
The correct way in my opinion is to provide the links on your home page for various locales your application needs to support. This is less intrusive for the end user. Otherwise the end user has to keep changing the locales browser specific way. Also different browsers send the locale different ways to the server which is also problematic depending on your usecase.
I strongly suggest you go through this tutorial.
Upvotes: 1
Reputation: 10714
FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
?
Upvotes: 10