第n天

来源:互联网 发布:openjdk7源码下载 编辑:程序博客网 时间:2024/05/16 07:59

今天碰到的问题
我在写新闻修改那部分代码时碰到了麻烦:dao通过测试是没问题的,service照着之前的写的,但是service在调用dao时总是调用不到,不知道为什么。

public Result mod(String Id,String Title, String Body, String Name) {        System.out.println("service");        News news = new News();        news.setNews_id(Id);        news.setNews_title(Title);        news.setNews_body(Body);        news.setNews_admin_name(Name);        Timestamp time = new Timestamp(System.currentTimeMillis());        news.setNews_last_modify_time(time);        int i = newsDao.updateNews(news);        Result result = new Result();        if(i == 0){            result.setMsg("修改失败!");        } else {            result.setMsg("修改成功!");        }        return result;    }

以上就是代码–service的部分。
19:38
这会儿,我已经知道是哪块的问题了:我在后台对前台传过去的数据进行了打印,结果发现:ID为null,原来是前台的问题啊!
20:30
问题终于解决完了!前台ID我使用了局部变量去定义,最终解决了ID为NULL的问题!

0 0
原创粉丝点击