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 209765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:56:42+00:00 2026-05-11T17:56:42+00:00

Ok simple question. I have a JSF application, containing a login page. The problem

  • 0

Ok simple question. I have a JSF application, containing a login page. The problem is if the user loads the login page, leaves it for a while, then tries to login the session expires and a ViewExpiredException is thrown. I could redirect back to the login when this happens, but that isn’t very smooth. How can I allow this flow to properly login without an additional attempt?

  • 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-11T17:56:42+00:00Added an answer on May 11, 2026 at 5:56 pm

    Update

    As of Mojarra 2.1.19 / 2.2.0 you can now set the transient attribute of the <f:view> to true:

    <f:view transient="true">
         Your regular content
    </f:view>
    

    You can read about in on Balusc’s blog here:

    http://balusc.blogspot.com.br/2013/02/stateless-jsf.html

    Original

    If you’re using Facelets you can create your own ViewHandler to handle this:

    public class LoginViewHandler extends FaceletViewHandler
    {
        public LoginViewHandler( ViewHandler viewHandler )
        {
            super( viewHandler );
        }
    
        @Override
        public UIViewRoot restoreView( FacesContext ctx, String viewId )
        {
            UIViewRoot viewRoot = super.restoreView( ctx, viewId );
    
            if ( viewRoot == null && viewId.equals( "/login.xhtml" ) )
            {
                // Work around Facelet issue
                initialize( ctx );
    
                viewRoot = super.createView( ctx, viewId );
                ctx.setViewRoot( viewRoot );
    
                try
                {
                    buildView( ctx, viewRoot );
                }
                catch ( IOException e )
                {
                    log.log( Level.SEVERE, "Error building view", e ); 
                }
            }
    
            return viewRoot;
        }
    }
    

    Change “/login.xhtml” to your login page. This checks to see if it can restore your view, and if it cannot and the current view is your login page it will create and build the view for you.

    Set this in your face-config.xml as follows:

    <application>
        <!-- snip -->
        <view-handler>my.package.LoginViewHandler</view-handler>
    </application>
    

    If you’re using JSF without Facelets (i.e. JSPs) you can try having the class extend ViewHandlerWrapper – note that buildView() will not be available. Hopefully createView() on it’s own will set the view up correctly but I’m not 100% sure with JSF/JSP.

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

Sidebar

Ask A Question

Stats

  • Questions 121k
  • Answers 121k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, and the flow does return to the spin method.… May 12, 2026 at 12:29 am
  • Editorial Team
    Editorial Team added an answer If you are using Module::Install, you can use Module::Install::Share and… May 12, 2026 at 12:29 am
  • Editorial Team
    Editorial Team added an answer In JSON serialization, strings need to be delimited with double… May 12, 2026 at 12:29 am

Related Questions

Is it possible to use a RegEx to validate, or sanitize Base64 data? That's
I hope this is a simple enough question for any SQL people out there...
Ok, a really simple question but I am too thick to figure it out.
Ok, simple problem hopefully. I have started to make a simple server for a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.