0 Replies Latest reply on May 18, 2007 10:06 AM by mvlach

    View and Business logic: 2x calling method for #{bean.items}

    mvlach

      I have problem with this:

      I have one action with one method: find

      this method starts with log message "finding" and prepare data for the view. After this method prepare data, the view should be displayed. But when I call the page in log appear the log from getItems method. But this method shloud be called after the business logic ends.

      Can somebody tell me where is the problem? When I call this action at first, all work ok. But the second request invoke first the getItems method.

       <ui:repeat var="i" value="#{searchResult.items}">
       <h:outputText value="#{i.date}" /> <h:outputText value="#{i.pi.position}" /> <h:outputText value="#{i.pi.page}" /> (#{i.pi.phrase})<br/>
       </ui:repeat>
      


      public String find() {
       log.info("finding: #0, #1", searchEntity.getKeyword(), searchEntity.getUrl());
      
       ....
       log.info("search finished");
      
       log.info("session object: #0", searchResult);
      
       log.info("adding results to the session variable");
       if (searchResult != null) {
       Date d = new Date();
      
       searchResult.add(d, ...);
       searchResult.add(d, ...);
       }
       log.info("results added");
       return null;
       }