0

How to terminate the page initiation ?

asked 2009-10-25 08:16:15 +0800

evpole gravatar image evpole
481 2

updated 2009-10-25 08:25:54 +0800

<?page?>
<window apply="Controller">....</window>

public class Cotroller(){

public Cotroller(){
// sometimes i need to stop the page initiation:

int stopnow= Integer.parseInt(Executions.getCurrent().getParameter("stopnow"));
if (stopnow==1){
Executions.getCurrent().forward('anotherpage.zul');
}

}

}


but it seems that doAfterCompose and onCreate method was always executed.
Is there any way to stop the process of initiation ?
Thanks for any suggestion.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2009-10-25 20:31:19 +0800

tomyeh gravatar image tomyeh
610 1 3
http://blog.zkoss.org ZK Team

You could throw an exception and then implement ComposerExt.doCatch to ignore the exception (by returning false).

link publish delete flag offensive edit

answered 2009-10-25 22:15:52 +0800

evpole gravatar image evpole
481 2

updated 2009-10-25 22:27:25 +0800

Thank you very much, tomyeh!

I tryed to throw an exception in the constructor, it's very well that the doAfterCompose method was not executed now .

but i'm not exactly know where to catch the exception .Could you please tell me more detail ?
i've tryed like this:



public class Cotroller extends GenericForwardComposer implements ComposerExt{

public Cotroller () throws Exception {
throw new Exception("stop now");
}

public boolean doCatch(){
return false;
}

// public void doAfterCompose(){
// System.out.println("still running");
// }

}

}

link publish delete flag offensive edit
Your reply
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

Follow

RSS

Stats

Asked: 2009-10-25 08:16:15 +0800

Seen: 314 times

Last updated: Oct 25 '09

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