问题
I have a strange issue with one of my bean method.
If I make date datatype from java.util.Date to java.sql.Date, one of the method in
my managedBean called actionEdit is not getting invoked when I click a button in jsf page.
My actionEdit() method
public void actionEdit(){
try {
beanValues.add(selectedRow);
for (Schedule editValues : beanValues) {
editValues.setStartDate(selectedRow.getStartDate());
editValues.setRemarks(selectedRow.getRemarks());
}
ScheduleDAO.editSchedule(beanValues);
beanValues.clear();
} catch (Exception e) {
// TODO: handle exception
logger.info("exception " + e.getMessage());
e.printStackTrace();
}
}
and it is called in jsf like the following
<p:commandButton value="Save"
action="#{schedule.actionEdit()}">
</p:commandButton>
What could be the reason for this behavior? Any ideas?
Thanks
回答1:
Change it back to java.util.Date and use java.sql.Date in the persistence layer only.
See also my answer on your previous question: Date Format Error java.sql.SQLException: Invalid column type.
来源:https://stackoverflow.com/questions/9547459/bean-method-not-getting-invoked-when-changed-to-java-sql-date