voyent
Display the status message for long running method  XML
Forum Index -> Components
Author Message
karthikayan

Joined: 09/May/2011 06:29:52
Messages: 31
Offline


Hi all,


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"/>

<ice:outputText value="#{bean.statusMsg}" ></ice:outputText>


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?

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

Thanks,
Karthikayan.R
mark.collette


Joined: 07/Feb/2005 00:00:00
Messages: 1692
Offline


With ICEfaces and JSF, each submit from the browser to the server follows a certain lifecycle, that includes one chance to render out updates to the webpage. So with just one submit, it's not really possible to update the webpage, do more processing and then update the webpage some more. What is possible though, is a slight variation of this, where your application does the submit to the server, kicks off a long running worker thread, and does the one update to tell the user that the work has commenced, and then that particular submit lifecycle completes. Then, from the worker thread, there can be any number of times that it will do a server push, which involve brand new lifecycles occurring, each with their own opportunity to update the webpage in the browser. When the long running worker thread is done it's job, it would typically do one last push lifecycle to inform the user that the work has completed, and then the thread finishes execution.

Applications would need to handle synchronization of state, since in the meanwhile, the user may well have clicked that submit button again, to kick off another long running job, while the first one is still in progress. For some applications this may be valid, and for some that might not be valid, which is why when they do the first lifecycle that kicks off the worker thread and does the webpage update to say that it's started, the updates may include disabling the submit button, or showing a modal dialog, which will block the user interface until that last server push is used to show the user that the job has completed, and also potentially hide the modal dialog or re-enable the submit button.

We have a tutorial online for using the ICEfaces 1.8.x server pushes here, which is a good starting place for learning this technique.

http://facestutorials.icefaces.org/tutorial/easy-ajax-push.html
[Email]
mark.collette


Joined: 07/Feb/2005 00:00:00
Messages: 1692
Offline


With ICEfaces and JSF, each submit from the browser to the server follows a certain lifecycle, that includes one chance to render out updates to the webpage. So with just one submit, it's not really possible to update the webpage, do more processing and then update the webpage some more. What is possible though, is a slight variation of this, where your application does the submit to the server, kicks off a long running worker thread, and does the one update to tell the user that the work has commenced, and then that particular submit lifecycle completes. Then, from the worker thread, there can be any number of times that it will do a server push, which involve brand new lifecycles occurring, each with their own opportunity to update the webpage in the browser. When the long running worker thread is done it's job, it would typically do one last push lifecycle to inform the user that the work has completed, and then the thread finishes execution.

Applications would need to handle synchronization of state, since in the meanwhile, the user may well have clicked that submit button again, to kick off another long running job, while the first one is still in progress. For some applications this may be valid, and for some that might not be valid, which is why when they do the first lifecycle that kicks off the worker thread and does the webpage update to say that it's started, the updates may include disabling the submit button, or showing a modal dialog, which will block the user interface until that last server push is used to show the user that the job has completed, and also potentially hide the modal dialog or re-enable the submit button.

We have a tutorial online for using the ICEfaces 1.8.x server pushes here, which is a good starting place for learning this technique.

http://facestutorials.icefaces.org/tutorial/easy-ajax-push.html
[Email]
karthikayan

Joined: 09/May/2011 06:29:52
Messages: 31
Offline


Hi,

Thanks for your reply.

That link is not working.

Can u provide a solution for my problem ?



Thanks,
Karthikayan.R



karthikayan

Joined: 09/May/2011 06:29:52
Messages: 31
Offline


Hi all,

Finally I have used sessionrenderer api.

It is working fine, when i open the application into different tab.

But current tab values not updated.

Any suggestions ,how to fix this?



Thanks,
Karthikayan.R
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


Updated link: http://www.icesoft.org/wiki/display/ICE/Easy+Ajax+Push

.
karthikayan

Joined: 09/May/2011 06:29:52
Messages: 31
Offline


Hi,

Philip thanks your response.

I am using icefaces 1.8, but that above link used icefaces3.

It is possible to use pushrenderer in icefaces 1.8?



Thanks,
Karthikayan.R
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


No, just the SessionRenderer, as you were using, sorry. The 1.8 version of the easyAjaxPush tutorial can be found in the ICEfaces bundle under icefaces/samples/tutorial/easyajaxpush.

Make sure you have the concurrentDOMViews parameter set to true in the web.xml if you want to use multiple tabs.

Code:
 <context-param>
 	<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
 	<param-value>true</param-value>
 </context-param>
 

.
karthikayan

Joined: 09/May/2011 06:29:52
Messages: 31
Offline


Hi philip,

Once again thanks for your response.

In Web.xml, I already configured that Concurrent Dom Views.

Working on different tab is working fine.

But problem is Without refresh a current page or without open the current page in different tab, values from backside it should update immediately in current page UI.

Thanks,
Karthikayan.R

 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team