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

Applet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <jsp:useBean id="project_newBean" class="MyFly.Bean.project_newBean" scope="request"/>
  3. <%@ page import="java.util.Date,java.text.SimpleDateFormat"%>
  4. <% request.setCharacterEncoding("GB2312");%>
  5. <%
  6.      String title=request.getParameter("title");
  7. if (title == null || title.equals(""))
  8. {
  9.    out.println("<Script language=JavaScript>alert('标题不能为空');JavaScript:history.back();</Script>");
  10. }
  11.     //title = new String(title.getBytes("ISO8859_1"));
  12.     String Content = request.getParameter("content");
  13. if (Content == null)
  14. {
  15.     out.println("<Script language=JavaScript>alert('请添加内容');JavaScript:history.back();</Script>");
  16. }
  17. //Content=new String(Content.getBytes("ISO8859_1"));
  18.  
  19.  
  20.  SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");//将显示"1999-10-1 21:03:10"的格式. 
  21.      Date currentTime_1 = new Date(); 
  22.      String appendTime = formatter.format(currentTime_1);
  23.  
  24.  project_newBean.setTitle(title);
  25.  project_newBean.setContent(Content);
  26.  project_newBean.setAppendTime(appendTime);
  27.  
  28. if(project_newBean.addNew() == 1)
  29. {
  30.      out.println("<script language=javascript>location.href='project_newView.jsp';</script>");
  31.  
  32. }
  33. else
  34. {
  35.    out.println("<Script language=JavaScript>alert('添加失败,请重新修改');JavaScript:history.back();</Script>");
  36. }
  37. %>