Hi,
I have this managed session bean defined in my faces-config.xml file:
<managed-bean>
<managed-bean-name>ConfigLoginBean</managed-bean-name>
<managed-bean-class>com.comcast.npsconfig.login.ConfigLoginBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
How do I access this bean from my
servlet? I've noticed invoking FacesContext.getInstances() returns null. This is what I currently have, which fails because of the NullPointerException.
private void doRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
...
// Get the config login bean.
FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
ConfigLoginBean configLoginBean = (ConfigLoginBean)app.getVariableResolver().resolveVariable(ctx, "ConfigLoginBean");
configLoginBean.finishLogin(uc);
...
}
Thanks for your help, - Dave