0 Replies Latest reply on Apr 11, 2011 6:39 PM by ginni machamer

    To checkbox or not to checkbox...

    ginni machamer Newbie

      I have a table with a varchar column that will either be null or have the word Expedite in it.  In my JSF, I need to present this as a checkbox with the word "Expedite" beside it.  I am able to map the value to my object, and it does properly display as checked if the column is populated and unchecked if not.  However, when I try to submit on this form (save changes), I get a string exception.

       

      It seems h:selectBooleanCheckbox wants to work with a boolean value.  That makes sense.  What is the best approach to map the submitted value into "Expedite" as a string?  Is this even the best component to use for this purpose?  I cannot update the database table to a boolean, unfortunately.

       

      What I've done so far is add a boolean to my object "expediteFlag" and method to get it based on if expedite has a value.  It's all mapped to the selectbooleancheckbox:

       

       

      <h:selectBooleanCheckbox title="expedite" styleClass="formCheckbox" value="#{libRequest.expediteFlag}">    

        </h:selectBooleanCheckbox>

       


      Thanks in advance for any ideas!

        <h:outputText value="Expedite"/>

      When I view a record now with Expedite, it is correctly showing as selected.

      However, when I try to save after creating a new record (same mappings), I get this wonderfully obtuse error message:

      Caused by:

      java.lang.StringIndexOutOfBoundsException: String index out of range: 0

       

       

      I cannot figure out what it is expecting.