to make it clear, inside the handleNavigation(...) you can do soemthing like this, to override the default behavior:
... @Override public void handleNavigation(FacesContext context, String fromAction, String outcome) { if("home".equals(outcome)) { String viewId ="/start.xhtml"; UIViewRoot root = context .getApplication().getViewHandler() .createView(context, viewId); FacesContext.getCurrentInstance().setViewRoot(root); } //no "home" called, use base one... else { _base.handleNavigation(context, fromAction, outcome); } } ... a commandButton like <h:commandButton .... action="home" /> would navigate to the hard coded page "start.xhtml" (just as an example) -M On 8/1/07, Matthias Wessendorf <[EMAIL PROTECTED]> wrote: > On 8/1/07, MichaelWa <[EMAIL PROTECTED]> wrote: > > > > Can someone help me to understand the following piece of code. > > 1. I noticed that JSF will call NavigationHandlerImpl(NavigationHandler > > base) constructor instead of default NavigationHandlerImpl() why? > > 2. JSF also will send the instance of NavigationHandlerImpl as parameter > > when it calls constructor NavigationHandlerImpl(NavigationHandler base), > > why? > > decorator pattern is used. > every jsf-impl has a default impl. of the abstract navhandler class. > the used one is "pushed" into your custom. > > that allows you to *delegate* back to the default, in case of there is > something that > you thnk the base does > use-cases: > Spring-Web-Flow / Shale: Dialog-Framework > > > 3.More intersted is this piece of code will handle navigation correctly > > (just like default NavigationHandler) if I config it into my JSF > > application, why? > > not sure I get it... > but you are doing nothing in here. > just *delegating* to the default one (base one) > > -M > > > > > Here is the code: > > > > import javax.faces.application.NavigationHandler; > > import javax.faces.context.FacesContext; > > > > public class NavigationHandlerImpl extends NavigationHandler { > > > > NavigationHandler _base; > > > > public NavigationHandlerImpl(NavigationHandler base){ > > super(); > > _base = base; > > } > > > > public NavigationHandlerImpl(){ > > super(); > > } > > > > @Override > > public void handleNavigation(FacesContext fc, String actionMethod, > > String > > actionName) { > > _base.handleNavigation(fc, actionMethod, actionName); > > } > > > > } > > > > > > here is my configutation: > > > > <application> > > > > <navigation-handler>com.abc.web.nav.NavigationHandlerImpl</navigation-handler> > > </application> > > > > -- > > View this message in context: > > http://www.nabble.com/NavigationHandler-tf4200242.html#a11946094 > > Sent from the MyFaces - Users mailing list archive at Nabble.com. > > > > > > > -- > Matthias Wessendorf > > further stuff: > blog: http://matthiaswessendorf.wordpress.com/ > mail: matzew-at-apache-dot-org > -- Matthias Wessendorf further stuff: blog: http://matthiaswessendorf.wordpress.com/ mail: matzew-at-apache-dot-org