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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:25:24+00:00 2026-06-03T21:25:24+00:00

I have a JSF page on Websphere Process Server (on top of WAS 7)

  • 0

I have a JSF page on Websphere Process Server (on top of WAS 7) which has ViewExpiredException. When this happens I want the user to be logged out and then logged back in
I’ve set up a redirect on this exception in web.xml to the following logout page:

<%  
  session.invalidate();
  response.sendRedirect("ibm_security_logout?logoutExitPage=/faces/ToDosOpen.jsp");
%>

Which then redirects to a login page:

<%@ page import="com.ibm.wbit.tel.client.jsf.infrastructure.Messages, java.util.Locale" language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%
    String contextPath = request.getContextPath();
    Locale locale = request.getLocale();
    final String SECURITY_CHECK = "j_security_check";
%>

...
</head>

<body>
...

<h1><%= Messages.getString("LOGIN_LINE", locale) %></h1>

<div class="help-text"><%= Messages.getString("LOGIN_LINE_DESCR", locale) %></div>

<form target="_top" method="POST" action=<%= SECURITY_CHECK %>>
    <table id="login-form">
        <tr>
            <td><%= Messages.getString("LOGIN_NAME", locale) %>:</td>
            <td><input type="text" name="j_username"></td>
        </tr>
        <tr>
            <td><%= Messages.getString("LOGIN_PASSWORD", locale) %>:</td>
            <td><input type="password" name="j_password"></td>
        </tr>
        <tr> 
            <td id="login-button" colspan="2">
<input type="submit" name="login" value="
<%= Messages.getString("BUTTON_LOGIN", locale) %>"></td>
            </tr>
    </table>

 </form>

And when you login you’re redirected to the page that caused the exception in the first place. Except what actually happens is the exception is thrown again, and back we go to the login page.

So you have to login twice.

Not sure what to do about this or where to start looking. Any help would be appreciated.
I have looked through existing questions on this and haven’t been able to solve it.


EDIT: I’ve forgotten to mention that this works fine if the action that triggered the exception was a refresh, but fails (having to login twice) if the action was clicking on a commandbar.

  • 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-03T21:25:26+00:00Added an answer on June 3, 2026 at 9:25 pm

    Finally solved it using the following ViewHandler.
    This basically recreates the view that expired. In the case where there were POST parameters, they’ve obviously been lost so any view that cannot be created without them needs special handling.

    Hopefully this is useful to anyone else who runs into this problem, and please let me know if you see anything wrong with this solution because I am not 100% confident in it.

    /**
     * This class just handles cases where the session expired
     * which causes an exception on reload.
     */
    public class ViewExpiredHandler extends ViewHandlerWrapper {
    
    private ViewHandler wrapped;
    
    public ViewExpiredHandler(ViewHandler wrapped) {
        this.wrapped = wrapped;
    }
    
    @Override
    public UIViewRoot restoreView( FacesContext ctx, String viewId )
    {
        UIViewRoot viewRoot = super.restoreView( ctx, viewId );
        try {
            if ( viewRoot == null) {
    
                viewRoot = super.createView( ctx, viewId );
                ctx.setViewRoot( viewRoot );
    
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return viewRoot;
    }
    
    @Override
    protected ViewHandler getWrapped() {
        return wrapped;
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSF Page which gets few inputs from the User, I want
I have a JSF page which has a variable number inputText elements containing numeric
I have a JSF page on which I want to have a checkbox that,
I have made few changes on this huge JSF page, which is full of
I have an JSF page backed by NewsBean.java which has <f:event type=preRenderComponent listener=#{newsBean.init} />
I have JSF page has two drop down lists and I want to load
I have a JSF 2.0 page where the user logs in and he has
We have a rich:comboBox on a JSF page which has a valueChangeListener that calls
i have a jsf page which displays an image from an url http://ichart.finance.yahoo.com/z?s=^NSEI&t=1d&q=l&l=on&z=l&p=s&a=v&p=s i
I have this JSF page: <div id=settingsdiv style=width:350px; height:400px; position:absolute; background-color:r; top:20px; left:1px> <h:form>

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.