We have one application where we are filling a form and subsequently thsese data are stored in database on click of "add " button. But, While clicking the button "add", i am getting the below mentioned error.
**"Failed to convert property value of type java.lang.String to required type boolean for property excelAttachFlag; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [] "**
Code :-
We have one property, named "excelAttachFlag" in our pojo class. The code in this class are :
private boolean excelAttachFlag;
public boolean isExcelAttachFlag() {
return excelAttachFlag;
}
public void setExcelAttachFlag(boolean excelAttachFlag) {
this.excelAttachFlag = excelAttachFlag;
}
Field used in database as :
EXCEL_ENABLED VARCHAR2(2 BYTE)
snippets of the code in "DAOJDBC" class is :
public boolean addClient(final AdminForm client) {
final Object params[] = new Object[] {client.getClientShortCode(),
client.getName(),
StringUtils.isBlank(client.getEmail()) ? null : client.getEmail(),
client.isExcelAttachFlag() ? "Y" : "N",
final StringBuilder sql = new StringBuilder(164);
sql.append("INSERT INTO CVR_CLIENT ");
sql.append("(INTERVENIENT_PSP,NAME, EMAIL, EXCEL_ENABLED)");
sql.append("VALUES (?, ?, ?, ?)");
protected static class ClientRowMapper implements RowMapper<Client> {
public Client mapRow(final ResultSet resultSet, final int rowCount) throws SQLException {
final Client client = new Client();
client.setRowCount(Integer.valueOf(resultSet.getInt("row_count")));
client.setShortCode(resultSet.getString("INTERVENIENT_PSP"));
client.setName(resultSet.getString("NAME"));
client.setEmail(resultSet.getString("EMAIL"));
String excelStatus=resultSet.getString("EXCEL_ENABLED");
if("Y".equalsIgnoreCase(excelStatus)){
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("------------excel enabled " + excelStatus);
}
client.setExcelAttachFlag(true);
}else{
client.setExcelAttachFlag(false);
}
return client;
}
}
View file ( VM file snippets) :-
<tr class="GMsearchFormA">
<td class="GMsearchstCol" nowrap="nowrap">#springMessage("label.name"):</td>
<td class="GMsearchstCol" nowrap="nowrap" colspan="2">#springFormInput("adminForm.name" "class='GMtradeSearch' size='80'")</td>
</tr>
<tr class="GMsearchFormA">
<td class="GMsearchstCol" nowrap="nowrap">#springMessage("label.attachExcel"):</td>
<td class="GMsearchstCol" nowrap="nowrap">#springFormCheckbox("adminForm.excelAttachFlag" "class='GMtradeSearch' size='80'")</td>
</tr>
could you please help me resolve this exception ?