title: Having trouble returning modified values from h:selectManyCheckbox
body: <p>I recently was placed on a project to add some new functionality to an existing jsf page. Things have been going smoothly up until this point. For the last week or two I have been consulting google and other stack overflow entries in an attempt to make this function correctly.</p>
  
  <p>I have datatable on my xhtml page  with a number of entries, some which have a h:selectmanycheckbox in them. The table and the checkboxes are all dynamically created. I can create the checkboxes without any trouble. I can also set their initial state to checked or unchecked based on database entries. However, I cannot pull any changes from the user when the form is submitted. The values returned are always equal to the initial state, regardless of what the user has entered. </p>
  
  <p><strong>AddRemoveSkills.xhtml</strong></p>
  
  <pre><code>&lt;h:panelGrid id="allSkills" style=" width : 706px;"&gt;
      &lt;ui:repeat var="cat" value="#{skillsController.masterCategories}"
          varStatus="status"&gt;
          &lt;h:form
              rendered="#{cat.toString().equalsIgnoreCase(skillsController.mode)||skillsController.mode.equalsIgnoreCase('Show All Skills')}"&gt;
              &lt;h3 class="arSkillsHeader"&gt;
                  &lt;h:outputLabel value="#{cat.toString()}"
                      style="font-weight:bold" /&gt;
              &lt;/h3&gt;
              &lt;h:dataTable style="margin-left:15px; margin-right:15px"
                  class="suggestionsTable" var="skill"
                  rowClasses="gray, lightgraybg"
                  columnClasses="null, hCol3, null, null"
                  value="#{skillsController.getSkillsByCategory(cat)}"&gt;
                  &lt;h:column&gt;
                      &lt;h:graphicImage value="/resources/images/success.png"
                          style="height:20px"
                          rendered="#{skillsController.hasSkill(cat.toString(), skill.name.toString())}" /&gt;
                  &lt;/h:column&gt;
                  &lt;h:column&gt;
                      &lt;h:outputText value="#{skill.name.toString()}" /&gt;                                           
                  &lt;/h:column&gt; 
                  &lt;h:column&gt;
                  &lt;!-- CheckBoxProblems lie here  --&gt;
                      &lt;h:selectManyCheckbox id="versions"
                                            layout ="lineDirection"
                                            style = "text-align: left;"
                                            value = "#{skill.checkedVersions}"&gt;
                          &lt;f:selectItems value="#{skillsController.getVersions(skill.getName(), skill.getCategoryName())}"/&gt;   
                      &lt;/h:selectManyCheckbox&gt; 
                  &lt;/h:column&gt;                 
                  &lt;h:column&gt;
                      &lt;h:selectOneMenu value="#{skill.proficiency}"&gt;
                          &lt;f:selectItem
                              itemValue="#{skillsController.timeList.get(0)}"
                              itemLabel="Select Experience Level" /&gt;
                          &lt;f:selectItems
                              value="#{skillsController.timeList.subList(1, skillsController.timeList.size())}" /&gt;
                          &lt;f:ajax listener="#{skill.setModified(true)}"/&gt;
                          &lt;f:ajax event="click" render="@this" /&gt;                                                 
                      &lt;/h:selectOneMenu&gt;
                  &lt;/h:column&gt;
              &lt;/h:dataTable&gt;
              &lt;h:panelGroup layout="block" style="height:20px"&gt;
                  &lt;h:commandButton value="Update Category" style="float:right; margin-right:15px;"
                      action="#{skillsController.updateCategorySkills(cat)}"
                      onclick="updatePro(this.id);"&gt;
                      &lt;f:ajax execute="@form" render="@form" /&gt;
                  &lt;/h:commandButton&gt;
              &lt;/h:panelGroup&gt;                             
          &lt;/h:form&gt;
      &lt;/ui:repeat&gt;
  &lt;/h:panelGrid&gt;
  </code></pre>
  
  <p><strong>Skill.java</strong></p>
  
  <pre><code>public class Skill implements Comparable&lt;Skill&gt; {
      protected String skill;
      protected String category;
      private String proficiency;
      private List&lt;String&gt; checkedVersions = new ArrayList&lt;String&gt;();
      private boolean modified;
  
      Logger logger = Logger.getLogger(Skill.class);
  ...
      /**
       * Gets a list of versions for this user's skill
       * 
       * @return Returns a string list containing the versions of this skill that the user has
       */
      public List&lt;String&gt; getCheckedVersions() {
          return checkedVersions;
      }
  
      /**
       * Sets a list of versions for this user's skills
       * 
       * 
       * @param checkedVersions A string list of checked versions
       */
      public void setCheckedVersions(List&lt;String&gt; checkedVersions) {
          if(checkedVersions != null){
              this.checkedVersions = checkedVersions;
              logger.info("Inside Skill, setCheckedVersions " + checkedVersions.toString()+ "skill name is: " + this.skill );
          }
  
      }
  </code></pre>
  
  <p><strong>SkillsController.java</strong></p>
  
  <pre><code>@ManagedBean
  @SessionScoped
  public class SkillsController implements Serializable {
      private static final long serialVersionUID = 1270888906016432185L;
      @ManagedProperty(value = "#{activeUser}")
      private ActiveUser user;
      private TreeMap&lt;String, Skill&gt; allSkillMap;
  private Map&lt;String, Map&lt;String, List&lt;String&gt;&gt;&gt; versionList;
  private Map&lt;String, Map&lt;String, List&lt;String&gt;&gt;&gt; checkedVersionList;
  public Skill getUserSkillByName(String name) {
      for (Skill skill : user.getSelfEmployee().getSkills()) {
          if (skill.getName().equals(name)) {
              if(checkedVersionList.containsKey(skill.getCategoryName())){
                  if(checkedVersionList.get(skill.getCategoryName()).containsKey(skill.getName())){
                          skill.setCheckedVersions(checkedVersionList.get(skill.getCategoryName()).get(skill.getName()));
                  }
              }
              return skill;
          }
      }
      return null;
  }
  /**
   * Get Versions for Skill
   * 
   * @param skillName
   * @param categoryName
   * 
   * @return returns a list containing all versions for this particular skill/category
   */
  public List&lt;String&gt; getVersions(String skillName, String categoryName) {
      if(versionList.containsKey(categoryName)){
          if( versionList.get(categoryName).containsKey(skillName)){
              return versionList.get(categoryName).get(skillName);
          }
      }
      return null;
  }
  </code></pre>
  
  <p><strong>ActiveUser.java</strong></p>
  
  <pre><code>@ManagedBean
  @SessionScoped
  public class ActiveUser {
      private Employee selfEmployee; // the current employee object
  </code></pre>
  
  <p><strong>Employee.java</strong></p>
  
  <pre><code>@RequestScoped
  public class Employee implements Comparable&lt;Employee&gt;, Serializable {
      private static final long serialVersionUID = 4875706805440817545L;
      private TreeSet&lt;Skill&gt; skills;
  </code></pre>
  
  <p>I have tried to show how all of my classes are scoped without cluttering this up with excess code. If there is anything more you would like me to add, let me know. </p>
  
  <p>Thanks in advance for any help given, I am at my wit's end on this problem.</p>