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

Applet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <%@ page import="java.util.Date,java.text.SimpleDateFormat"%>
  3. <jsp:useBean id="sale_manageBean" class="MyFly.Bean.sale_manageBean" scope="request"/>
  4. <%
  5.   request.setCharacterEncoding("gb2312");
  6. %>
  7. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  11. <title>无标题文档</title>
  12. </head>
  13. <body>
  14. <%
  15.     String title=request.getParameter("title");
  16. String neirong=request.getParameter("neirong");
  17. String name=(String)session.getAttribute("name");
  18. if ( name == null || name.equals("") ){
  19. response.sendRedirect("login.jsp?msg=nologin");
  20.    out.println("<Script language=JavaScript>alert('您还没登录,没有权利发表');javascript:history.back();</Script>");
  21.    }
  22.     SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");//将显示"1999-10-1 21:03:10"的格式. 
  23.     Date currentTime_1 = new Date(); 
  24.     String appendTime = formatter.format(currentTime_1); 
  25. sale_manageBean.setUsername(name);
  26. sale_manageBean.setTitle(title);
  27. sale_manageBean.setContent(neirong);
  28. sale_manageBean.setRecontent("");
  29. sale_manageBean.setAppendTime(appendTime);
  30. sale_manageBean.setIsHuifu("no");
  31. if(sale_manageBean.addNew() == 1)
  32. {
  33.      out.println("<script language=javascript>alert('留言成功,谢谢支持');JavaScript:location.href='sendmessage.jsp';</script>");
  34.  
  35. }
  36. else
  37. {
  38.    out.println("<Script language=JavaScript>alert('留言失败');JavaScript:history.back();</Script>");
  39. }
  40. %>
  41. </body>
  42. </html>