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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:15:28+00:00 2026-05-15T21:15:28+00:00

I am using JSF 1.2 + Facelets + Apache My Faces without Tomahawk or

  • 0

I am using JSF 1.2 + Facelets + Apache My Faces without Tomahawk or other libs. I use a customized container. I have a scenario to implement but I am not sure How to achieve the same using JSF + Facelets. These are my questions : Appreciate any help you can provide. Thanks!

Scenario : I have only one page + one backing bean , By default , the request is sent to that only one page and so everything is okay. Based on some data in the backing bean once the request has come, I determine whether the user should be allowed to see the page or not. If he should not, I should send the user to other page or an error page.

1) Is it mandatory to use a template in Facelets?
2) How to achieve if and else conditionals using Facelets ? Is it possible?
3) Is this correct ?- The Backing Bean constructor always returns to the page for which the request has come – This one is little confusing as Constructors cannot return a “String”
4) How do i send the user to a different page or where to place to code to send him to a diff 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-05-15T21:15:29+00:00Added an answer on May 15, 2026 at 9:15 pm

    This should not be done in the view side, but in the controller side. The normal practice is to use a Filter for this. Create a class which implements Filter and does basically the following (pseudo) in doFilter() method:

    if (request meets conditions) {
        chain.doFilter(request, response);
    } else {
        response.sendRedirect(errorPageURL);
        // or response.sendError(statusCode, message);
    }
    

    You can alternatively also handle the redirect in the bean’s constructor with help of ExternalContext, but that’s not really the right place for this.

    public Bean() {
        if (request does not meet conditions) {
            FacesContext.getCurrentInstance().getExternalContext().redirect(errorPageURL);
            // Or externalContext.responseSendError(statusCode, message);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using JSF 1.2 with Richfaces and Facelets. I have an application with many
Using Richfaces 3.3.0GA, jsf 1.2_14 and facelets. I have a richfaces ModalPanel with an
I have developed a java web application using JSF 2.0(Facelets) on GlassFish 3.1.1 with
I am using JSF 2.0 and have defined property javax.faces.FACELETS_SKIP_COMMENTS to skip comments in
Using jsf 1.2, hibernate, richfaces 3.3.0GA and facelets. I have this code in my
I have a problem using JSF to display some data in Facelets. I have
Using: JSF 1.2, Facelets 1.1.15, GateIn 3.1 GA, Richfaces 3.3.3 I have some common
I'm using JSF (Mojarra 1.2) with Richfaces (3.3.2) within some facelets which are used
I'm building a web App using JSF 2.0 and had a jaf-facelets.1.1.10 jar in
Goal: I want to use jsf`s i18n Scenario: creating resource bundle (utf-8) file info:

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.