3 Replies Latest reply on Nov 20, 2009 8:02 AM by Stan Silvert

    server.getManagedBeanValue is null

    Raj S Newbie

      We are experiencing issues when trying to get the managedbean value after successful authentication. The server.getManagedBeanValue always returns null. In the code we are using Spring framework for managing beans instead of faces-config.xml and these beans are defined as a session scope beans. This null value is displayed after the successful authentication. We can access the page as text but am unable to access the managed beans. Any suggestion, pointers ?


      Sample Spring Config :
      <bean id="testBean" lazy-init="true"
      scope="session"
      class="com.test.TestBean">
      <beans:property name="testService" ref="testService" />
      <aop:scoped-proxy />


      And the web.xml has the the filters defined in the below link http://labs.jboss.com/jsfunit/gettingstarted.html


      This is the JSFUnit testcase

      WebClientSpec wcSpec = new WebClientSpec("/test.xhtml");
      FormAuthenticationStrategy formAuth = new FormAuthenticationStrategy("username", "password");
      formAuth.setSubmitComponent("login");
      wcSpec.setInitialRequestStrategy(formAuth);
      JSFSession jsfSession = new JSFSession(wcSpec);
      JSFClientSession client = jsfSession.getJSFClientSession();
      JSFServerSession server = jsfSession.getJSFServerSession();

      assertEquals("/test.xhtml", server.getCurrentViewID());
      assertTrue(client.getPageAsText().contains("Test Page"));
      assertEquals("test", server.getManagedBeanValue("#{testBean.userName}"));

      We always gets the null pointer when tried to access managedbean via JSFServerSession