Specify another Desktop Cleanup to an specific page

asked 2014-10-03 10:09:12 +0800

Neus gravatar image Neus
1415 14

Hi, I have implemented a DesktopCleanup in my application indicating the DesktopCleanup class in my zk.xml

But now, I have a page where I have to do something more when the page is closed. How can I do it?? The application DeskopCleanup must be executed beacuse it has generic cleanups but I need something more specific also.

Thank you!

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-10-03 11:49:05 +0800

takach gravatar image takach
30 2

I think you need only one DesktopCleanup implementation, and switch to different cases in it.

You got a reference to the Desktop in the implemented cleanup() method. According to that you can program different behaviors. I am not a ZK expert, I guess you can set some attribute on your ZUL files or Controllers, and then you can read this argument in the cleanup method. So you will known, from which page is just closing.

link publish delete flag offensive edit

answered 2014-10-03 13:37:04 +0800

cyiannoulis gravatar image cyiannoulis
1191 10

Another solution to your problem might be to use native javascript like this:

window.addEventListener("beforeunload", function (e) {
     /* call a servlet to do a job */

Take care that in this function you cannot make use of zAu.send(event) because the ViewModel (or the controller) is not "listening" anymore, but you may call a servlet to do anything you want.

Hope that helps


link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2014-10-03 10:09:12 +0800

Seen: 10 times

Last updated: Oct 03 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More