addliouyan.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="messageboardBean" class="MyFly.Bean.messageboardBean" 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 name=request.getParameter("name");
  16. if(name == null)
  17. {
  18.     name="";
  19. }
  20. String mailbox=request.getParameter("mailbox");
  21. if(mailbox == null)
  22. {
  23.    mailbox="";
  24. }
  25. String face=request.getParameter("face");//头像
  26. String qq=request.getParameter("qq");
  27. if(qq == null)
  28. {
  29.    qq="";
  30. }
  31. String title=request.getParameter("title");
  32. if(title == null)
  33. {
  34.    title="";
  35. }
  36. String content=request.getParameter("content");
  37. if(content == null)
  38. {
  39.    content="";
  40. }
  41. SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");//将显示"1999-10-1 21:03:10"的格式. 
  42.     Date currentTime_1 = new Date(); 
  43.     String appendTime = formatter.format(currentTime_1); 
  44. messageboardBean.setName(name);
  45. messageboardBean.setMailbox(mailbox);
  46. messageboardBean.setFace(face);
  47. messageboardBean.setQq(qq);
  48. messageboardBean.setTitle(title);
  49. messageboardBean.setContent(content);
  50. messageboardBean.setHuifu("");
  51. messageboardBean.setTime(appendTime);
  52. messageboardBean.setHuifutime(appendTime);
  53. messageboardBean.setIsHuifu("no");
  54. if(messageboardBean.addNew() == 1)
  55. {
  56.      out.println("<script language=javascript>alert('留言成功,谢谢支持');JavaScript:location.href='indexme.jsp';</script>");
  57.  
  58. }
  59. else
  60. {
  61.    out.println("<Script language=JavaScript>alert('添加失败,请重新添加');JavaScript:history.back();</Script>");
  62. }
  63. %>
  64. </body>
  65. </html>