Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7866823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:31:17+00:00 2026-06-03T00:31:17+00:00

we have an JSF2.0 / EJB3.0 Application. Is it possible to access user’s language/locale

  • 0

we have an JSF2.0 / EJB3.0 Application. Is it possible to access user’s language/locale from within a StatelessSessionBean? For example something like that?

@Stateless
@Local(MyService.class)
public class MyServiceBean implements MyService {

    @Resource
    private SessionContext context;

    public void doSomething() {
        Principal principal = context.getCallerPrincipal();

        // how to get acccess to user's language ?
        Locale locale = ...
    }
}

Of course it is possible to pass the Locale from web tier to ejb tier by parameter to each method. But is this the smartest variant?

Is there a better solution similar to context.getCallerPrincipal();

I am looking for somthing like: context.getCallerLocale();

Thanks for your help.
Viktor

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:31:18+00:00Added an answer on June 3, 2026 at 12:31 am

    There is no such standard feature. One technique is to use a thread-local, but you need to carefully ensure you call .remove() to avoid causing problems with your container’s thread pool. The only other alternative is to use a vendor-specific feature, such as WebSphere Application Server’s Internationalization service.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSF2 (GlassFish 3.0) application which security constraints defined (example below). My
[My Setup: Java EE 6 application, with EJB3.1, CDI/Weld, JSF2 running on Glassfish 3.0.1]
My JSF2 application is fully internationalized, using a ResourceBundle. Now i have a lot
I have simple JSF2 application running on glashfish 3.1. I want to add a
I have a JSF2 application that uses Spring 3.0. I have a bean that
I have a JSF2 application and a page with the following code: <h:inputText id=someInput
I have a web application currently deployed in jetty8, which is based on jsf2,
I have a more complex webapp in JSF2 (+EJB3.1 +JPA2 on glassfish 3.1), which
I have a problem with following tutorial: http://www.mkyong.com/jsf2/jsf-2-internationalization-example/ In faces-context file you have to
I am using JSF2.0 with Richfaces 4.0.0.Final for a web application. I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.