更改为java.sql.Date时未调用Bean方法 [英] Bean method not getting invoked when changed to java.sql.Date
问题描述
我的bean方法之一有一个奇怪的问题.
如果我将日期数据类型从java.util.Date
更改为java.sql.Dat
e,则其中的一种方法
当我单击jsf页面中的按钮时,不会调用名为actionEdit
的我的ManagedBean.
I have a strange issue with one of my bean method.
If I make date datatype from java.util.Date
to java.sql.Dat
e, one of the method in
my managedBean called actionEdit
is not getting invoked when I click a button in jsf page.
我的actionEdit()方法
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();
}
}
它在jsf中的调用方式如下
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?
谢谢
推荐答案
将其更改回java.util.Date
,并在持久层仅中使用java.sql.Date
.
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.
这篇关于更改为java.sql.Date时未调用Bean方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!