light_productInsert.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="light_productBean" class="MyFly.Bean.light_productBean" 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.  SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");//将显示"1999-10-1 21:03:10"的格式. 
  19.      Date currentTime_1 = new Date(); 
  20.      String appendTime = formatter.format(currentTime_1);
  21.  
  22.  light_productBean.setTitle(title);
  23.  light_productBean.setContent(Content);
  24.  light_productBean.setAppendTime(appendTime);
  25.  
  26. if(light_productBean.addNew() == 1)
  27. {
  28.      out.println("<script language=javascript>location.href='light_productView.jsp';</script>");
  29.  
  30. }
  31. else
  32. {
  33.    out.println("<Script language=JavaScript>alert('添加失败,请重新修改');JavaScript:history.back();</Script>");
  34. }
  35. %>