newUpdate.jsp
上传用户:yatiankong
上传日期:2014-05-16
资源大小:5604k
文件大小:1k
源码类别:

Applet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=GB2312"%>
  2. <%@ page import="java.sql.* ,java.util.Date,java.text.SimpleDateFormat"%>
  3. <%
  4.   request.setCharacterEncoding("GB2312");
  5. %>
  6. <jsp:useBean id="newBean" class="MyFly.Bean.newBean" scope="request"/>
  7. <body bgcolor="#799ae1">
  8. <%
  9.     String index=request.getParameter("index");
  10. String topic=request.getParameter("topic");
  11. String Content=request.getParameter("content");
  12. String origin=request.getParameter("origin");
  13. SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");//将显示"1999-10-1 21:03:10"的格式. 
  14.     Date currentTime_1 = new Date(); 
  15.     String appendTime = formatter.format(currentTime_1); 
  16. newBean.setNewID(Integer.parseInt(index));
  17. newBean.setTopic(topic);
  18. newBean.setContent(Content);
  19. newBean.setOrigin(origin);
  20. newBean.setAppendTime(appendTime);
  21. if(newBean.update() == 1)
  22. {
  23.      out.println("<script language=javascript>location.href='newView.jsp';</script>");
  24.  
  25. }
  26. else
  27. {
  28.    out.println("<Script language=JavaScript>alert('添加失败,请重新添加');JavaScript:history.back();</Script>");
  29. }
  30. %>
  31. </body>