title: JSF 1.2 - Problem with passing page count to bean to create list
body: <p>I have this select option:</p>
  
  <pre><code>&lt;f:verbatim&gt;Pages: &lt;/f:verbatim&gt;
  &lt;h:selectOneMenu id="selectPage" value="#{pageList.selectedPage}"&gt;
      &lt;f:selectItems value="#{pageList.selectPages}" /&gt;
  &lt;/h:selectOneMenu&gt;
  </code></pre>
  
  <p>And the backing bean (called <strong>mybean2</strong>) for this is:</p>
  
  <pre><code>private int pages;
  
  public void getPages(int Pages) 
  {
   this.pages = Pages;
  }
  
  // getter methods
  public List&lt;SelectItem&gt; getSelectPages() 
  {
   selectPages = new ArrayList&lt;SelectItem&gt;();
          pages++;
          for (int i = 1; i &gt; pages; i++) {
           selectPages.add(new SelectItem(Integer.toString(i), Integer.toString(i)));
          } 
  
       return selectPages;
  }
  
  public String getSelectedPage()
  {
       return selectedPage;
  }
  
  // setter methods
  public void setSelectPages(List&lt;SelectItem&gt; selectPages) {
          this.selectPages = selectPages;
  }  
  
  public void setSelectedPage(String selectedPage) {
       this.selectedPage = selectedPage;
  }
  </code></pre>
  
  <p>The <strong>getPages</strong> method above gets the page count from <strong>mybean1.submit</strong> method. Thus, for example, when the submit method returns 30, how am I able to pass this value into the getSelectPages method so it can dynamically created the number of pages as in:</p>
  
  <pre><code>for (int i = 1; i &gt; pages; i++) {
  </code></pre>
  
  <p>Also, I want <strong>mybean2</strong> to be generic i.e. I don't want other beans to be referenced within mybean2 directly. For example, I don't want to reference like this within mybean2:</p>
  
  <pre><code>mybean1 mb1 = new mybean1();
  pages = mb1.getPages();
  </code></pre>
  
  <p>Otherwise, I have to declare separate instances of other beans (about 12 others) that send pages count to mybean2 for it to action - this way would be way too messy...</p>
  
  <p>Any hint or code example is much appreciated. Thanks.</p>