I am having a problem with the DelegatingViewResolver. I have written a JSF phase listener to intercept requests before the RESTORE_VIEW phase. My application than tries to retrieve a JSF managed bean via an EL expression factory. The managed bean has a reference to a spring managed component. The managed bean is constructed, but during the el coerce method, I am receiving an initialization failed exception. When I take the spring service component out of my managed bean xml config, the phase listener is able to construct the managed bean without any problems. Does anyone have an idea why this is happening? below is my code and config...
Code:<lifecycle> <phase-listener>com.asc.ltp.web.listeners.RedirectPhaseListener</phase-listener> </lifecycle> <application> <message-bundle>com.asc.ltp.web.messages</message-bundle> <variable-resolver> org.springframework.web.jsf.DelegatingVariableResolver </variable-resolver> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> </application> <managed-bean> <managed-bean-name>ActivationApi</managed-bean-name> <managed-bean-class>com.asc.ltp.web.ActivationAPIImpl</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>accountManager</property-name> <value>#{standardAccountManager}</value> </managed-property> </managed-bean> public void beforePhase(PhaseEvent event) { try{ FacesContext ctx = event.getFacesContext(); HttpServletRequest request = (HttpServletRequest)ctx.getExternalContext().getRequest(); ELContext elCtx = ctx.getELContext(); ExpressionFactory ef = ctx.getApplication().getExpressionFactory(); ValueExpression ve = ef.createValueExpression(elCtx,"${ActivationApi}", ActivationAPI.class); ActivationAPIImpl activationManager = (ActivationAPIImpl)ctx.getApplication().createValueBinding("#{LoginManager}").getValue(); ActivationAPIImpl activationAPI = (ActivationAPIImpl)ve.getValue(elCtx); //fails here!


Reply With Quote