【JSP开源代码栏目提醒】:网学会员为广大网友收集整理了,insertInformation.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"> 备
忘
录
<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"> 插
入
信
息:
</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="提交">
<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>
上一篇:
insertClient.jsp
下一篇:
7*30m公路预应力混凝土连续梁桥上部结构设计