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

Applet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <jsp:useBean id="sharesortBean" class="MyFly.Bean.sharesortBean" scope="request"/>
  3. <jsp:useBean id="sharesubstanceBean" class="MyFly.Bean.sharesubstanceBean" scope="request"/>
  4. <jsp:useBean id="sharesortBeans" class="MyFly.Bean.sharesortBeans" scope="request"/>
  5. <%@ page import="java.sql.* ,java.util.Date,java.text.SimpleDateFormat"%>
  6. <%
  7.   request.setCharacterEncoding("GB2312");
  8. %>
  9. <%
  10.     String type=request.getParameter("type");
  11.     String title=request.getParameter("title");
  12. String content=request.getParameter("content");
  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. String name=(String)session.getAttribute("name");
  17. if(name == null)
  18. {
  19.    out.println("<Script language=JavaScript>alert('请登陆后再发贴吧!');location.href='../index.jsp';</Script>");
  20. }
  21. else
  22. {
  23.                 if(title == null || title.equals("") || title == "")
  24.         {
  25.                out.println("<Script language=JavaScript>alert('请填写标题');JavaScript:history.back();</Script>");
  26.         }
  27.         if(content == null || content.equals("") || content == "")
  28.         {
  29.               out.println("<Script language=JavaScript>alert('请填写内容');JavaScript:history.back();</Script>");
  30.         }
  31.         sharesubstanceBean.setSucceedFxID(Integer.parseInt(type));
  32. sharesubstanceBean.setName(name);
  33. sharesubstanceBean.setTitle(title);
  34. sharesubstanceBean.setContent(content);
  35. sharesubstanceBean.setAppendTime(appendTime);
  36. sharesubstanceBean.addNew();
  37. response.sendRedirect("success_share.jsp");
  38. }
  39. %>