I need your help in getting the values of a list into two variables. My list is having descriptions and codes. However, I need to place the descriptions in a variable and the codes in a different variable, so how can I achieve this.
My Code is
private String[] selectedCertificates;
private List<SelectItem> Certificates;
public List<SelectItem> getCertificatesList(){
Certificates = new ArrayList<SelectItem>();
Certificates.add(new SelectItem("Certificate A","A"));
Certificates.add(new SelectItem("Certificate B","B"));
return bankCertificates;
}
public void setCertificates(List<SelectItem> Certificates) {
this.Certificates = Certificates;
}
// Setters and Getters
Select Item Code:
<p:selectManyCheckbox id="Certificates" value="#{user.selectedCertificates}"
layout="pageDirection" disabled="#{user.secondToggle}">
<f:selectItems value="#{user.Certificates}" var="bankCertificates"
itemLabel="#{user.CertificatesString}" itemValue="#{user.CertificatesCode}"/>
</p:selectManyCheckbox>
where can I define that the description should be the first value and the code should be the second value in the list and I can use them in the page.
Thanks