title: javax.faces.model.SelectItem is storing value object as String
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10601710/primefaces-selectonemenu-listener-not-called-with-objects-other-than-strings">Primefaces selectOneMenu listener not called with Objects other than Strings</a>  </p>
  </blockquote>
  
  
  
  <p>I am creating <code>List</code> of <code>SelectItem</code> as:</p>
  
  <pre><code>List&lt;SelectItem&gt; activityGlobalTypes = new ArrayList&lt;SelectItem&gt;();
  
  for (ActivityTypeXMLModel activityTypeXMLModel : filteredActivityTypeXMLModels) {
      activityGlobalTypes.add(new SelectItem(activityTypeXMLModel, activityTypeXMLModel.getParent()));
  }
  </code></pre>
  
  <p>This is the dropdown menu:</p>
  
  <pre><code>&lt;p:selectOneMenu id="activityGlobalMenu" value="#{adminController.activityDTO.activityParentName}" required="true"&gt;
      &lt;f:selectItem itemLabel="Select One" itemValue="" /&gt;  
      &lt;f:selectItems value="#{adminController.activityGlobalTypes}" /&gt;
      &lt;p:ajax listener="#{adminController.updateDependentActivity}" /&gt;                        
  &lt;/p:selectOneMenu&gt;
  </code></pre>
  
  <p>Now from the method <code>updateDependentActivity</code></p>
  
  <pre><code>public void updateDependentActivity(AjaxBehaviorEvent event) {
      SelectOneMenu menu = (SelectOneMenu) event.getComponent();
      System.out.println(menu.getValue());//it prints com.edfx.adb.xml.model.ActivityTypeXMLModel@7b6fe3c4
  
      if(menu.getValue() instanceof ActivityTypeXMLModel) {
          System.out.println("value is ActivityTypeXMLModel"); // I was expecting this one
      } else if(menu.getValue() instanceof String) {
          System.out.println("value is String"); //this line is executing 
      } else {
          System.out.println("unknown");
      }   
  }
  </code></pre>
  
  <p>I have checked the source code of <code>SelectItem</code> and it is storing value in object form. Any pointer would be very helpful.</p>