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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:04:49+00:00 2026-05-20T21:04:49+00:00

This is driving me insane, is there any good way for redirecting JSF page

  • 0

This is driving me insane, is there any good way for redirecting JSF page from Filter?
Here is my code in doFilter()

       try {

            HttpServletRequest req = (HttpServletRequest) request;
            HttpServletResponse res = (HttpServletResponse) response;
            LoginAgent loginAgent = (LoginAgent) req.getSession().getAttribute("login");

            if (loginAgent == null || !loginAgent.isLoggedIn()) {
                res.sendRedirect("requireslogin.xhtml");
            }
            else {
                chain.doFilter(request, response);
            }

All I got is a blank page. I have tried other way but none works and I haven’t met a good example on redirecting to another JSF page without involving too much work.

Is there any workaround for this? Basically the filter is used for disabling anonymous user from reaching pages.

  • 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-20T21:04:49+00:00Added an answer on May 20, 2026 at 9:04 pm

    Just for your information, in case if you are running into the same problem with me, and want an alternative way out, you can use phaseListener for checking user login status.

    I am still stuck with the filter, but I figured I better opt this way (the PhaseListener), it is much easier to understand at least to me and more elegant (at least in my eyes, lol).

    you can follow the guide from this guy’s blog. Awesome one.

    http://gurolerdogan.blogspot.com/2010/04/controlling-login-by-phaselistener-in.html

    While some of you might encounter problem as every page shall be rerouted to the login page when user is not logged in, this is easily fixed by redefining your navigation rule in faces-config.

    Thanks to whoever that bears with my noobity in handling JSF! Especially you, BalusC 🙂

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

Sidebar

Related Questions

This is driving me insane! Here's the code: public static void main(String[] strings) {
Any help most appreciated, this is driving me insane. I'm doing exactly what I
This is driving me insane, this is HTML code. <html> <head> <script> function init()
This is driving me insane! (ios 5+, ARC) Pretty simple concept here: I have
Hoping someone can help me here as this is driving me insane. I used
This is driving me insane. I'm trying to INSERT a value into the following
This is driving me insane. The Maven failsafe plugin will not run on my
This is driving me absolutely insane. I know that, to change the formatting of
This one is driving me insane, and i can't figure out why it's throwing
This function is driving me insane! def CCAD1 (tree) leaves = [] for otu

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.