my dog learned polymorphism*
The moose likes JSF and the fly likes Status Message display to user side for long running method in jsf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Status Message display to user side for long running method in jsf" Watch "Status Message display to user side for long running method in jsf" New topic
Author

Status Message display to user side for long running method in jsf

Karthikayan Rajasekaran
Greenhorn

Joined: Nov 09, 2012
Posts: 3
Hi all,

I am using jsf 1.2 with icefaces 1.8.

My doubt is I have a command button called process. Whenever i clicked this button process method is called. The process method execution takes nearly 10 minutes.

I want to display the status message to user side.

I have tried like this.

<ice:commandButton value="process" action="#{bean.process}" immediate="true"/>

<iceutputText value="#{bean.statusMsg}" ></iceutputText>


public void process()
{
public void start();
public void stop();
public void restart();
}



public void start()
{
setStatusMsg("Started");
...........
...........
}

public void stop()
{
setStatusMsg("Started");
.............
}

public void restart()
{
setStatusMsg("ReStarted");
....................................
}

Here problem is last method status only printed in user side.(restarted).


How to print the status of each method in icefaces1.8 or jsf 1.2?

Please help me , very urgent.............

Thanks,
Karthikayan.R
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

Welcome to the JavaRanch, Karthikayan!

You cannot do that in JSF, general J2EE, or, for that matter, in any web platform in any programming language.

HTTP is a strict request/response protocol. One request gets one response. Therefore you cannot make a request, get a "busy" response back, followed by a "done" response. You get only one response and that response isn't posted out until request processing is complete.

For a long-running process, you will need to offload the long-running part to a separate thread. Note that you cannot spawn this thread from within JSF or servlet/JSP code - that is explicitly forbidden by the J2EE standards (and will possibly crash your appserver). You can, however, construct an out-of-band "engine" process in a webapp servletcontextlistener and post your long-running requests to it. The JSF code would then be in charge of sending the request to the engine, polling the engine status (you can use AJAX for this), and returning the completed results once the engine has finished the request.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Status Message display to user side for long running method in jsf
 
Similar Threads
Help understanding error messages
JLabel setText not working in actionListener
Error message
Bluetooth Chat application
Problem with cannot find symbol message