Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating from facelets 1.1 to faclets 2.0 - FaceletViewHandler

Tags:

jsf-2

facelets

I have read the following post which was very helpful Migrating from JSF 1.2 to JSF 2.0

but I am having a problem with the migration as I have a custom view handler which extends from FaceletViewHandler - this is not part of faclets 2.

I am migrating on JBoss 4.2.2 the following: - JSF 1.2 to JSF 2.0

I also want to migrate the faclets - which i have a problem described above.

In my application, I am also using Tomahawk - is there any problem with this migration?

Thanks in advance.

Elico.

like image 764
Elico Avatar asked Jul 25 '11 12:07

Elico


1 Answers

Right, you need to replace FaceletViewHandler by ViewHandlerWrapper.

So the following basic FaceletViewHandler implementation:

import javax.faces.application.ViewHandler;
import com.sun.facelets.FaceletViewHandler;

public class MyViewHandler extends FaceletViewHandler {

    public MyViewHandler(ViewHandler parent) {
        super(parent);
    }

    // ...
}

needs to be updated as follows:

import javax.faces.application.ViewHandler;
import javax.faces.application.ViewHandlerWrapper;

public class MyViewHandler extends ViewHandlerWrapper {

    private ViewHandler wrapped;

    public MyViewHandler(ViewHandler wrapped) {
        this.wrapped = wrapped;
    }

    @Override
    public ViewHandler getWrapped() {
        return wrapped;
    }

    // ...
}

I've updated my answer on the migration question accordingly.

like image 130
BalusC Avatar answered Sep 28 '22 07:09

BalusC