0 Replies Latest reply on Sep 9, 2008 3:10 PM by Daniel Pocock

    RequestParameter annotation failing

    Daniel Pocock Newbie
      There is a session bean (I've tried statefull and stateless) called SearchManagerBean (component name searchManager)

      The request parameter is injected and there is a getter, plus one method:

        @RequestParameter
        String queryString;

        public String getQueryString() {
          return queryString;
        }

        public String search() {
          return "/nodeList.xhtml";
        }

      When rendering nodeList.xhtml, there is a `nodes' component, supplied by the @Factory method in another bean, NodeManagerBean:

        @In(create=false, required=false)
        SearchManager searchManager;

        @Factory("nodes")
        public void findNodes() {
          StringBuffer q = "FROM Node";
          if(searchManager != null)
            q = "FROM Node WHERE name LIKE '%" + searchManager.getQueryString() + "%'";
          nodes = em.createQuery(q).getResultList();
        }


      The problem I face is this:
      - in the search() method of SearchManagerBean, the value of queryString is useable
      - however, when searchManager.getQueryString() is called from the @Factory method in NodeManagerBean, the searchManager instance that has been injected says that the parameter is null

      One solution I found was making the SearchManagerBean scope CONVERSATION, however, this means that the search parameter is used every time the nodeList is fetched - that is not what I want.  I only want the parameters to hang around for long enough to render the page.

      I also tried encapsulating the queryString in another JavaBean, with scope PAGE, that didn't work either.