On 8/14/05, David Thielen <[EMAIL PROTECTED]> wrote: > Hi; > > > > This may already be in shale - I'm only using shale's mock objects so far, > not shale itself. > > > > Something I would find VERY useful is for shale to call a backing bean > before rendering a page - where there is a way to tie a page to a method in > a bean so anytime page dave.jsp is going to be rendered, it first calls this > method which can then redirect. >
Shale already has the "call a method before rendering" functionality -- if your backing beans implement ViewController, you'll receive a call to prerender() at this point. Redirection is then possible, using standard JSF techniques: if (do_not_go_there) { FacesContext context = FacesContext.getCurrentInstance(); context.getExternalContext().redirect(absoluteURL); } You can also use ExternalContext.forward() to do a RequestDispatcher.forward() style call instead, if you want. Just be sure to call context.responseComplete() afterwards, to tell JSF you have already created the output for this page. > > > This is very useful for both security checks (essential actually) and to > make sure someone does not save a url that is 4 pages through a page by page > step and then goes back to that url. > Hmm ... this seems to me like something you might want to embed in the overall application controller, rather than having to deal with it on every single page. Shale defines a Commons Chain command stream that is applied (to every request) by its ApplicationFilter -- it would be straightforward to customize this. > > Thanks - dave > Craig McClanahan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]