Bean method not getting invoked when changed to java.sql.Date

你。 提交于 2019-12-12 02:29:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!