⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 insertinformation.jsp

📁 java web jsp 站点实例 源代码
💻 JSP
字号:
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage=""%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link href="css/style.css" type="text/css" rel="stylesheet">
    <title>带有备忘录的万年历</title>
    <jsp:useBean id="connection" scope="request" class="com.JDBConnection"/>
    <style type="text/css">
      <!--
        .style1 {
        font-size: 24px;
        color: #FFFFFF;
        font-weight: bold;
        }
      -->
    </style>
<script language="javascript" type="">
function alertMsg(form){
if (form.subject.value=="")
{alert("请添入备忘录内容!");return false;}
if (form.hours.value=="")
{alert("请添入提示时间!");return false;}
if (isNaN(form.hours.value))
{alert("您添入的提示时间有误,应为数字类型!");return false;}
if ((form.hours.value>=24) || (form.hours.value<0))
{alert("您添入的提示小时有误,请确认后再添!");return false;}
if (form.minutes.value=="")
{alert("请添入提示分钟!");return false;}
if (isNaN(form.minutes.value))
{alert("您添入的提示分钟有误,应为数字类型!");return false;}
if ((form.minutes.value>60) || (form.minutes.value<0))
{alert("您添入的提示分钟有误,请确认后再添!");return false;}
}
</script>
  </head>
  <body bgcolor="#9CA6C6">
  <%request.setCharacterEncoding("gb2312");  %>
    <div align="center" class="style1">      备
      &nbsp;&nbsp;
      &nbsp;&nbsp;
      <form name="form" method="post" action="insertInformation.jsp" onSubmit="return alertMsg(form)">
        <table width="437" border="0">
          <tr>
            <td height="30" colspan="5">
              <strong>
                <font color="#FFFFFF">                  插
                  &nbsp;&nbsp;
                  &nbsp;&nbsp;
                  &nbsp;&nbsp;
                  息:
                </font>
              </strong>
            </td>
          </tr>
          <tr>
            <td height="30" colspan="5">
              <input name="subject" type="text" size="70">
            </td>
          </tr>
          <tr>
            <td width="106" height="30">
              <strong>
                <font color="#FFFFFF">提醒的具体时间</font>
              </strong>
            </td>
            <td width="98">
              <input name="hours" type="text" size="13">
            </td>
            <td width="71">
              <strong>
                <font color="#FFFFFF">小时</font>
              </strong>
            </td>
            <td width="71">
              <input name="minutes" type="text" size="13">
              <input name="showtime" type="hidden" value="<%=request.getParameter("showtime")%>">
            </td>
            <td width="69">
              <strong>
                <font color="#FFFFFF">分</font>
              </strong>
            </td>
          </tr>
        </table>
        <input type="submit" name="Submit2" value="提交">
        &nbsp;&nbsp;
        <input type="button" name="Submit" value="关闭" onClick="javascript:window.close()">
      </form>
    <%
      if (request.getParameter("subject") != null) {
        String showTime = request.getParameter("showtime") + "." + request.getParameter("hours") + "." + request.getParameter("minutes");
        String sql = "insert into tb_calendar values ('" + request.getParameter("subject") + "','" + showTime + "')";
        if (connection.executeUpdate(sql)) {
          out.println("添加备忘纪录正确!!!");
        }
        else {
          out.println("您填写的备忘时间已经存在,请重新填写!!!");
        }
        connection.closeConnection();
      }
    %>
    </div>
  </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -