[jboss-user] [JBoss Seam] - PhaseListener as Seam Component

iakneissl do-not-reply at jboss.com
Wed Nov 15 11:24:23 EST 2006


Hi,

is it possible, to annotate a phase listener as seam bean and to inject another bean?

my code looks like this:

##############
the phase listener:

@Name("keeper")
@Scope(ScopeType.SESSION)
@Intercept(InterceptionType.ALWAYS)
public class KeeperPhaseListener implements PhaseListener {

	public KeeperPhaseListener() { }
	
	@In(value="navBean", create=true, required=true)
	private NavigationBean navBean;

	public void beforePhase(PhaseEvent e) {    }
    
    public void afterPhase(PhaseEvent e) {
        keep(e, e.getFacesContext().getViewRoot().getViewId());
    }

    protected void keep(PhaseEvent e, String viewId) {
        navBean.setCurrentPage(viewId);
    }

    public PhaseId getPhaseId() {
        return PhaseId.RENDER_RESPONSE;
    }
}

###################
and the annotation of the bean to inject:

@Name("navBean")
@Scope(ScopeType.SESSION)
public class NavigationBean implements Serializable {

...


in all other beans, the injection works fine.
Both beans are deployed as seam components, but the BijectionInterceptor doesn't work for the KeeperPhaseListener. navBean is null and the required annotation is ignored.

Thanks for help!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986206#3986206

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986206



More information about the jboss-user mailing list