this is my xhtml code.
<h:form>
<h:dataTable value="#{user.classes()}" var = "rs2" >
<h:column>
<f:facet name="header">CLASS CODE </f:facet>
<h:selectManyCheckbox value="#{user.takenclass}">
<f:selectItem itemValue= "#{rs2.CID}" itemLabel = " #{rs2.CID}"/>
</h:selectManyCheckbox>
</h:column>
<h:column>
<f:facet name="header">CLASS NAME </f:facet>
#{rs2.CLASSNAME}
</h:column>
<h:column>
<f:facet name="header">TEACHER NAME</f:facet>
#{rs2.NAME}
</h:column>
</h:dataTable>
<h:commandButton value="SAVE" action="#{user.takeClass()}"/>
</h:form>
So it basically show you the classes you can take. Im using checkboxes and taking CID as a CHAR with 3 digits like 001, 002. what i want to do is, writing a JAVA code user.takeClass() and take those CIDS seperatly as string or char (idk if both of them works) and add it to my derby database. Here is how my db looks.
STC is stundent number and one student can have multiple class while one class can have multiple students.
the sql injection will be like this:
INSERT INTO TAKECLASS
VALUES(CID,STC)
you have to log in to take class so STC is already on the bean. I just need the CIDs.