更改为java.sql.Date时未调用Bean方法 [英] Bean method not getting invoked when changed to java.sql.Date

查看:148
本文介绍了更改为java.sql.Date时未调用Bean方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的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.Date, 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆