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

  • SEARCH
  • Home
  • 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 6025741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:20:40+00:00 2026-05-23T04:20:40+00:00

I am upgrading my app to JSF 2 from JSF 1.2. I have ran

  • 0

I am upgrading my app to JSF 2 from JSF 1.2.

I have ran into the following issue. I had locale handler which handled the locale used by examing the URL of the request.

@Configurable
public class MutationViewHandler extends FaceletViewHandler {

@Autowired
private LanguageMutationServiceIface mutationService;

public MutationViewHandler(ViewHandler parent) {
    super(parent);
}

@Override
public Locale calculateLocale(FacesContext context) {
    String mutation = FacesUtil.getRequestParameter("mutation");
    if (mutation == null) {
        return new Locale(mutationService.getDefaultLanguageMutation().getName());
    } else {
        return new Locale(mutation);
    }
}
}

But in JSF 2 is this class deprecated and causes error (NPE) when used in MyFaces. I have tried to implement it using simple ViewHandler, but it forces me to implement many methods where I wish to use the default behaviour.

Thanks for help in advance.

  • 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-05-23T04:20:41+00:00Added an answer on May 23, 2026 at 4:20 am

    You need to extend ViewHandlerWrapper instead.

    Provides a simple implementation of ViewHandler that can be subclassed by developers wishing to provide specialized behavior to an existing ViewHandler instance. The default implementation of all methods is to call through to the wrapped ViewHandler.

    Usage: extend this class and override getWrapped() to return the instance we are wrapping.

    So, you can just do

    public class MyViewHandler extends ViewHandlerWrapper {
    
        private ViewHandler wrapped;
    
        public MyViewHandler(ViewHandler wrapped) {
            this.wrapped = wrapped;
        }
        
        @Override
        public ViewHandler getWrapped() {
            return wrapped;
        }
    
        @Override
        public Locale calculateLocale(FacesContext context) {
            // Do your thing here.
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm upgrading an app from rails 3.1.1 to rails 3.2. I had to update
I have an app that I'm upgrading from some beta bits - and my
I'm upgrading our app from rails 2.3.10 to 2.3.12, and in doing so had
I have an MVC3 app which was using EF CTP5. After upgrading to EF
I'm upgrading an app with many different settings files from XP to Vista and
I'm upgrading an app from prototype.js to jquery. I've got this code (prototype.js): var
In my app, I am upgrading from Cocos2D version 1.10->2.0-rc0a. So I did everything
Upgrading .Net Events system from Tridion 2009 to Tridion 2011 SP1. Does anyone have
I'm upgrading an ASP.NET 4.0 app from: Windows Server 2003 and IIS 6 to:
I have noticed since upgrading to iOS5 that an audio app I have been

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.