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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:48:26+00:00 2026-06-01T07:48:26+00:00

I am currently banging my head where to put a common logic for some

  • 0

I am currently banging my head where to put a common logic for some authorization stuff in my Java EE 6/JSF 2 webapp:
I have the requirement, that all requests that come with a specific cookie should be redirected to another page.

I considered 3 solutions:

1) use a servlet 3.0 filter (@WebFilter)
this worked, i also could inject my managed beans there, but the managed beans require access to the faces externalContext, which at filter invocation time has not yet been set up, so i got NPE’s calling the managed beans

2) use a phase listener
this feels awkward, because a phase listener cannot be a CDI component and so cannot inject other components (except via el-evaluation); a phaseListener for me feels to technical to put navigation logic into it.

3) in Seam 2.0 i could used “page actions” for things like this, but it seems that this concept didn’t make it into JSF 2.0

in seam this looked like:

<page view-id="/admin/*.jsf">
    <action execute="#{authenticator.checkAccess()}" />
</page>

Is it really, that JSF 2.0 does not have a concept to execute “controller logic” before rendering a page?

  • 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-01T07:48:27+00:00Added an answer on June 1, 2026 at 7:48 am

    In JSF 2.x you can listen to page events like that:

    <f:metadata>
       <f:event type="javax.faces.event.PreRenderViewEvent" listener="#authenticator.checkAccess()}" />
    </f:metadata>
    

    That is more or less equivalent to Seam 2 page action (you will have to filter out postbacks though). You can further enhance the default behavior with CDI-extensions like Seam Faces. Probably it’s a good idea if you have a look at the documentation and see what fits your needs…

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

Sidebar

Related Questions

I have been banging my head on this problem for sometime. There are some
I'm trying to implement a weighted random numbers. I'm currently just banging my head
I have been banging my head on this one all day. The C++ project
I'm upgrading a Java object that currently has XML representation in this spirit: <myObjects>
I have been banging my head on this one for hours and I am
So I have been banging my head on this one. I have a self
I've been banging my head trying to figure some things out. So, I'm looking
I have a bug in my current code that I have been banging my
Currently we have a project to implement an Internet Banking site, and we are
Currently I have the following code creating my timer: <script type=text/javascript> var interval; var

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.