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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:15:44+00:00 2026-06-05T02:15:44+00:00

I have an ICEfaces web app which contains a component with a property linked

  • 0

I have an ICEfaces web app which contains a component with a property linked to a backing bean variable. In theory, variable value is programmatically modified, and the component sees the change and updates its appearance/properties accordingly.

However, it seems that the change in variable isn’t “noticed” by the component until the end of the JSF cycle (which, from my basic understanding, is the render response phase).

The problem is, I have a long file-copy operation to perform, and I would like the the inputText component to show a periodic status update. However, since the component is only updated at the render response phase, it doesn’t show any output until the Java methods have finished executing, and it shows it all changes accumulated at once.

I have tried using FacesContext.getCurrentInstance().renderResponse() and other functions, such as PushRenderer.render(String ID) to force XmlHttpRequest to initialize early, but no matter what, the appearance of the component does not change until the Java code finishes executing.

One possible solution that comes to mind is to have an invisible button somewhere that is automatically “pressed” by the bean when step 1 of the long operation completes, and by clicking it, it calls step 2, and so on and so forth. It seems like it would work, but I don’t want to spend time hacking together such an inelegant solution when I would hope that there is a more elegant solution built into JSF/ICEfaces.

Am I missing something, or is resorting to ugly hacks the only way to achieve the desired behavior?

  • 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-05T02:15:46+00:00Added an answer on June 5, 2026 at 2:15 am

    Multithreading was the missing link, in conjunction with PushRenderer and PortableRenderer (see http://wiki.icesoft.org/display/ICE/Ajax+Push+-+APIs).

    I now have three threads in my backing bean- one for executing the long operation, one for polling the status, and one “main” thread for spawning the new threads and returning UI control to the client browser.

    Once the main thread kicks off both execution and polling threads, it terminates and it completes the original HTTP request. My PortableRenderer is declared as PortableRender portableRenderer; and in my init() method (called by the class constructor) contains:

    PushRenderer.addCurrentSession("fullFormGroup");    
    portableRenderer = PushRenderer.getPortableRenderer();
    

    For the threading part, I used implements Runnable on my class, and for handling multiple threads in a single class, I followed this StackOverflow post: How to deal with multiple threads in one class?

    Here’s some source code. I can’t reveal the explicit source code I’ve used, but this is a boiled-down version that doesn’t reveal any confidential information. I haven’t tested it, and I wrote it in gedit so it might have a syntax error or two, but it should at least get you started in the right direction.

    public void init()
    {
        // This method is called by the constructor.
        // It doesn't matter where you define the PortableRenderer, as long as it's before it's used.
        PushRenderer.addCurrentSession("fullFormGroup");
        portableRenderer = PushRenderer.getPortableRenderer();
    }   
    
    
    public void someBeanMethod(ActionEvent evt)
    {
        // This is a backing bean method called by some UI event (e.g. clicking a button)
        // Since it is part of a JSF/HTTP request, you cannot call portableRenderer.render
    
        copyExecuting = true;
    
        // Create a status thread and start it
    
        Thread statusThread = new Thread(new Runnable() {
            public void run() {
            try {
                            // message and progress are both linked to components, which change on a portableRenderer.render("fullFormGroup") call
                message = "Copying...";
                // initiates render. Note that this cannot be called from a thread which is already part of an HTTP request
                portableRenderer.render("fullFormGroup"); 
                do {
                    progress = getProgress();
                    portableRenderer.render("fullFormGroup"); // render the updated progress
                    Thread.sleep(5000); // sleep for a while until it's time to poll again
                } while (copyExecuting);
                progress = getProgress();
                message = "Finished!";
                portableRenderer.render("fullFormGroup"); // push a render one last time
            } catch (InterruptedException e) {
                System.out.println("Child interrupted.");
            }
        });
        statusThread.start();
    
        // create a thread which initiates script and triggers the termination of statusThread
        Thread copyThread = new Thread(new Runnable() {           
            public void run() {
            File someBigFile = new File("/tmp/foobar/large_file.tar.gz");
                scriptResult = copyFile(someBigFile); // this will take a long time, which is why we spawn a new thread
                copyExecuting = false; // this will caue the statusThread's do..while loop to terminate
    
    
            } 
        });
        copyThread.start();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small web application developed using Icefaces 1.8.2 and jsf 1.1 which
I have a web-app (let's call it app1),in which I can't even see the
Posting this one for a friend. They have an Icefaces app that uses Icefaces's
While evaluating ICEfaces I have used Eclipse and its Web Page Editor to visually
Problem Description: My injected Spring bean defined as a Managed-Property to a JSF backing
i have a strange problem. I have an ICEFaces(1.8.2) + Facelets application im working
Have a simple one-off tasks which needs a progress bar. OpenSSL has a useful
I have a IceFaces-form and several input fields. Let's say I have this: <ice:selectOneMenu
I'm still on the road of learning JSF. I have an IceFaces tree with
I have a small problem with double-click handling with icefaces. There are two methods

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.