health_centerInsert.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="health_centerBean" class="MyFly.Bean.health_centerBean" 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.  health_centerBean.setTitle(title);
  22.  health_centerBean.setContent(Content);
  23.  health_centerBean.setAppendTime(appendTime);
  24.  
  25. if(health_centerBean.addNew() == 1)
  26. {
  27.      out.println("<script language=javascript>location.href='health_centerView.jsp';</script>");
  28.  
  29. }
  30. else
  31. {
  32.    out.println("<Script language=JavaScript>alert('添加失败,请重新修改');JavaScript:history.back();</Script>");
  33. }
  34. %>