I am working on a JAVA EE application. I am creating a form using itext. This would be saved as a pdf file. I have two fields (ID Number and Passport Number). I am currently struggling with performing a null check on them. For instance, if the ID number field is null, then check whether or not the Passport Number field is null. If both are null, then display a text "No ID Numbers detected."
ID Number and passport numbers are of type string.
This is my code presently.
PdfPCell a3 = new PdfPCell();
a3.setColspan(4);
a3.addElement(PdfUtil.getSmallParagraph("ID NUMBER: " + (client.getIdNumber() != null ? client.getPassportNo() : "")));
tbl.addCell(a3);