5 Replies Latest reply on Oct 6, 2011 7:41 AM by jaikiran pai

    lookup a managed bean

    paul.setzermann Newbie

      Hey all,

       

      Is it possible to lookup a @ManagedBean in a helper class?

      I tried something like the following but it is not working (->NamingExeption):

       

      InitialContext ic = null;
      try {
           ic = new InitialContext();
           SearchView searchView = (SearchView)ic.lookup("java:module/searchView");
      
      } catch (NamingException e) {
           e.printStackTrace();
      }
      
      
      

      I also tried:

      Name of my .war: AnnotationDatabase

         ...lookup("java:app/AnnotationDatabase/searchView")
         ...lookup("java:global/AnnotationDatabase/searchView")
      

       

       

      SearchView:

       

      @ManagedBean(name="searchView")
      @SessionScoped
      public class SearchView implements Serializable {
      ...
      }
      

       

       

      Thanks and Cheers,

      Paul