Re: Calling a specific page + Event

"Geoff Longman" <[email protected]>
Newsgroups gmane.comp.java.tapestry.devel
Message-ID <017101c2a695$b056ed60$1700a8c0@MOONBEAM>
> Gleaned from the Vlib demo:
>
> What you can do is use cycle.getPage("error page name"), cast it to your
> error page class, and then invoke a method on it to set the error code,
> before calling cycle.setPage(error page object).
>

You could also pass a page name to the ErrorPage, so the user could click a
button to continue.

For convenience , one might extend SimpleEngine and add  goErrorMethods like
this:

// pass control to the error page, setting its code and making its continue
page the current page
public void goError(int code, IRequestCycle cycle) throws
RequestCycleException {

    goError(code, cycle.getPage().getName(), cycle);

}

// pass control to the error page, setting its code and  its continue page
public void goError(int code, String continuePage, IRequestCycle cycle)
throws RequestCycleException {

  ErrorPage epage = (ErrorPage)cycle.getPage("Error");
  epage.setCode(code);
  epage.setContinuePage(continuePage);
  cycle.setPage(epage);

}





-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.