title: How to make one SelectManyMenu depends on other in JSF?
body: <p>I have two selectManyMenu in PrimeFaces:</p>
  <pre><code>    &lt;p:selectManyMenu id=&quot;vehicleMakes&quot;
            value=&quot;#{analyticsController.selectedVehiclesMake}&quot;
            filter=&quot;true&quot;
            filterMatchMode=&quot;startsWith&quot;
            multiple=&quot;true&quot;
            scrollHeight=&quot;250&quot;
            showCheckbox=&quot;true&quot; 
            styleClass=&quot;customInput manymenu-advanced&quot;
            label=&quot;#{msg['ANALYTICS-vehicle-brand-select']}&quot;&gt;
            &lt;f:selectItems var=&quot;make&quot; itemLabel=&quot;#{make}&quot;
                   value=&quot;#{analyticsController.vehicleMakeList}&quot;
                   itemValue=&quot;#{make}&quot;
            /&gt;
                   &lt;p:ajax event=&quot;change&quot;  listener=&quot;#{analyticsController.restoreFilters()}&quot;&gt; 
                   &lt;/p:ajax&gt;
      &lt;/p:selectManyMenu&gt;
  </code></pre>
  <p>An other:</p>
  <pre><code>&lt;p:selectManyMenu id=&quot;vehicleModels&quot;
           value=&quot;#{analyticsController.selectedVehiclesModel}&quot;
           filter=&quot;true&quot;
           filterMatchMode=&quot;startsWith&quot;
           multiple=&quot;true&quot;
           scrollHeight=&quot;250&quot;
           onchange=&quot;familyComponents(this, 'gfVehicleModelList', 'selectManyMenu')&quot;  
           showCheckbox=&quot;true&quot; 
           styleClass=&quot;customInput manymenu-advanced gfVehicleModelList&quot;
           label=&quot;#{msg['ANALYTICS-vehicle-model-select']}&quot;&gt;
           &lt;f:selectItems 
                 var=&quot;model&quot; 
                 itemLabel=&quot;#{model}&quot;
                 value=&quot;#{analyticsController.vehicleModelList}&quot;
                 itemValue=&quot;#{model}&quot;
           /&gt;
  &lt;/p:selectManyMenu&gt;
  </code></pre>
  <p>But I need that when an element is selected in select number one the content is loaded depending on a FK in select number two, for this I create this function:</p>
  <pre><code>public void filterModelBySelectedMakes(){
          if (!CollectionUtils.isEmpty(selectedVehiclesMake) &amp;&amp; !CollectionUtils.isEmpty(makes)){
              List&lt;Integer&gt; makeIds = makes.stream().filter(make -&gt; selectedVehiclesMake.contains(make.getName())).map(Make::getId).sorted().collect(Collectors.toList());
              vehicleModelList = models.stream().filter(model -&gt; makeIds.contains(model.getMakeId())).map(Model::getName).filter(StringUtils::isNotBlank).sorted().collect(Collectors.toList());
          }
      }
  </code></pre>
  <p>Using directly the List  that I already have loaded, but I don't know when to execute this function? Or if there is another easier method, could you help me please?</p>
  <p>Thanks in advance</p>