3 Replies Latest reply on Oct 26, 2010 6:52 AM by Shervin Asgari

    Whats the point with Session scope on Unwrap

    Shervin Asgari Master

      Hi.


      Consider this example




      @Scope(ScopeType.SESSION)
      @Name("test")
      @BypassInterceptors
      public Class Test {
      
          @Unwrap
          public List<String> test() {
            //do a long and major calculation and return the List
          }
      }





      Then you have a view and you are getting your list



      <h:selectOneMenu value="#{someBean.text}">
          <s:selectItems value="#{test}"/>
      </h:selectOneMenu>



      Now in my opinion, because I have Scope session, the list should be cached, or the component at least, however, so that it will run once, but then when you revisit the page in the same session, ut should not run again, but when I re-enter the page the Unwrap method is yet again run.
      So my question is: What is the difference between Session scope and say Event scope here?


      To circumvent this I have manually cached the list in the session context in the @Create method and return the list.