cherishjia 2014-08-17 09:16 采纳率: 0%
浏览 1911

修改文章信息 数据库没有任何更新

想对写好的文章进行修改 但是修改后没有任何变化。

private void modifyArticle(HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    response.setContentType("text/html;charset=utf-8");
    HttpSession session=request.getSession();
    ArticleBean articleBean=new ArticleBean();
    ArticleDao articleDao=new ArticleDao();

    /*String strId=request.getParameter("id");
    int id = Integer.parseInt(strId);*/
    String title=request.getParameter("title");
    String content=request.getParameter("content");
    Date cur=new Date(new java.util.Date().getTime());
    String time=cur.toLocaleString();

    //articleBean.setArt_id(id);
    articleBean.setArt_title(title);
    articleBean.setArt_time(time);
    articleBean.setArt_content(content);

    try {
        articleDao.operationArticle("modify", articleBean);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    request.getRequestDispatcher("manage.jsp").forward(request, response);

}

Dao:

if(oper.equals("modify")){
        sql="update article set art_title='"+single.getArt_title()+"',art_content='"+single.getArt_content()+"',art_time='"+single.getArt_time()+"' where art_id="+single.getArt_id();
    }
  • 写回答

1条回答 默认 最新

  • dison_ 2014-08-18 03:02
    关注

    一般出现这样的情况:
    1.请确认是否已添加相关事务配置?
    2.SQL语句是否正确,是否报错?

    评论

报告相同问题?

悬赏问题

  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器