myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: NavigationHandler
Date Wed, 01 Aug 2007 14:10:00 GMT
On 8/1/07, MichaelWa <hengwang74@inbox.com> 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

Mime
View raw message