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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:05:34+00:00 2026-05-22T15:05:34+00:00

I’ve got a dropdown on my index.xhtml JSF front page. The associated code/commandButton looks

  • 0

I’ve got a dropdown on my index.xhtml JSF front page. The associated code/commandButton looks like this:

    <h:selectOneMenu id="nodes" value="#{MyBacking.chosenNode}">
    <f:selectItems value="#{MyBacking.nodes}" />
</h:selectOneMenu>

<a4j:commandButton value="Retrieve" styleClass="ctrlBtn"
    id="retrieveBtn" style="margin-bottom: 2px;"
    onclick="#{rich:component('nodeLoadWait')}.show()"   # modal
    action="#{MyBacking.redirect}"
    image="/img/btnRetrieve26.png" />

action was set to ‘hello’ previously, and in my faces-context.xml:

<navigation-rule>
    <from-view-id>/index.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>hello</from-outcome>
        <to-view-id>/nodeMgmt.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>

When action was set to ‘hello’, clicking the retrieve button worked OK in that faces would handle the nav and MyBacking.setChosenNode method would assign all the necessary data, so that the content of nodeMgmt.xhtml would be displayed fully populated.

However, if the initial activity caused by the user clicking retrieve times out, the web page would hang even though the bean detects the time out, and I’d like to redirect the user to a ‘timed out’ page.

In order to handle the backing bean returning a timedout message (the error detection for which is already present when ‘inside’ the app), I thought rather than using the faces-context.xml file, I would handle it internally.

I found FacesContext.getCurrentInstance().getExternalContext().redirect but the JSF 1.2 javadoc does not feature this. Perhaps it’s because it’s not featured? It redirects though which is confusing. Why no documentation on this method?

Nonetheless, it redirects me to the page, but renders without taking into account the data instantiated by the bean during the initial request. The bean is in request scope currently. The relevant code in the bean is

    try {
        FacesContext.getCurrentInstance().getExternalContext().redirect("nodeMgmt.jsf");
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

Is using a backend java call the best way to do this kind of redirection?
If not, is it best to use faces-context.xml? If so, how?
While we’re here – can anyone direct me to a good reading resource for FacesContext.getCurrentInstance().getExternalContext() usage which has decent examples about how to do simple navigation with data cos I’m having trouble locating one.

Cheers

  • 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-22T15:05:35+00:00Added an answer on May 22, 2026 at 3:05 pm

    I found FacesContext.getCurrentInstance().getExternalContext().redirect but the JSF 1.2 javadoc does not feature this. Perhaps it’s because it’s not featured? It redirects though which is confusing. Why no documentation on this method?

    There certainly is.

    • JSF 1.1: ExternalContext#redirect()
    • Java EE 5 (JSF 1.2): ExternalContext#redirect()
    • Java EE 6 (JSF 2.0): ExternalContext#redirect()

    Probably you was reading the wrong javadoc. The one of FacesContext perhaps?


    Nonetheless, it redirects me to the page, but renders without taking into account the data instantiated by the bean during the initial request. The bean is in request scope currently.

    A redirect instructs the browser to fire a brand new HTTP request. So all request scoped beans from the old request will be garbaged and reinitialized in the new request. If you’d like to retain the request, you’d like to use a forward instead (which JSF by default uses), but this isn’t going to work on ajax-initiated requests as it will stick to the same page anyway. Only a response with a redirect will force Ajax to change the window location using JavaScript.

    If you want to retain some parameters in the new request, you’d have to pass them as request parameters. E.g.

    externalContext.redirect("nodeMgmt.jsf?foo=bar");
    

    and set them as managed property in the bean.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
i got an object with contents of html markup in it, for example: string
I have a JSP page retrieving data and when single or double quotes are
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm making a simple page using Google Maps API 3. My first. One marker

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.