各位大神 请帮忙给我把这个留言板连接到数据库,再加上查看留言的功能
<%@ page language="java" import="java.util.*" contentType="text/html; charset=gb2312"pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/WebRoot/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Insert title here</title>
<style type="text/css">
<!--
body {
background-image: url(image/bjbj.jpg);
background: repeat-x150 0;
}
#apDiv1 {
position:absolute;
left:70px;
top:12px;
width:1000px;
height:113px;
z-index:1;
}
#apDiv2 {
position:absolute;
left:3px;
top:0px;
width:1001px;
height:201px;
z-index:1;
}
#apDiv3 {
position:absolute;
left:2px;
top:199px;
width:156px;
height:570px;
z-index:2;
visibility: visible;
}
#apDiv4 {
position:absolute;
left:158px;
top:202px;
width:845px;
height:567px;
z-index:3;
visibility: visible;
}
#apDiv5 {
position:absolute;
left:7px;
top:205px;
width:145px;
height:253px;
z-index:4;
}
.STYLE2 {font-size: large}
.STYLE3 {font-size: larger}
.STYLE8 {font-size: 36px}
.STYLE10 {color: #0000FF}
</style>
</head>
<body>
<div id="apDiv2"><img src="image/20140225040207958.jpg" width="1000" height="199" /></div>
<div id="apDiv3"><img src="image/zuo.jpg" width="156" height="570" /></div>
<div id="apDiv4">
<div align="center">
<label>
<div align="left"></div>
<span class="STYLE2"><font color="#0000FF">
<span class="STYLE3">
<span class="STYLE8">
</label>
<b></span></span></font><span class="STYLE3"><span class="STYLE8"><strong><font face="楷体_GB2312">留 言 版</font></strong></span></span></span></b></div>
<form name="form1" method="post" action="" >
<table width="70%" height="392" border="1" align="center" bordercolor="#669900" background="image/db254dfdb253bfdefc037f9d.jpg">
<tr>
<td width="10%" height="24"><div align="left">留言人</div></td>
<td colspan="2">
<div align="left">
<input name="user" type="text" id="user">
<font color="#FF0000">*</font>
<label></label>
</div></td>
</tr>
<tr>
<td height="81">头像</td>
<td width="42%"> <select name="tou" id="tou" onchange="bb()">
<option value="images/01.gif">images/01.gif</option>
<option value="images/04.gif">images/04.gif</option>
<option value="images/03.jpg">images/03.jpg</option>
<option value="images/05.jpg">images/05.jpg</option>
<option value="images/06.jpg">images/06.jpg</option>
<option value="images/07.jpg">images/07.jpg</option>
</select></td>
<td width="48%"><img name="img" src="images/01.gif" width="70" height="77" alt=""></td>
</tr>
<tr>
<td height="29"><div align="left">来 自</div></td>
<td colspan="2"><div align="left">
<label>
<select name="cf" id="cf">
<option>---请选择你所在的地方---</option>
<option>湖南省</option>
<option>湖北省</option>
<option>江西省</option>
<option>浙江省</option>
<option>河南省</option>
<option>河北省</option>
<option>广东省</option>
<option>海南省</option>
</select>
</label>
<font color="#FF0000">*</font></div></td>
</tr>
<tr>
<td height="32"><div align="left">email</div></td>
<td colspan="2"><div align="left">
<input name="email" type="text" id="email">
<font color="#FF0000">*</font></div></td>
</tr>
<tr>
<td height="28"><div align="left">标 题</div></td>
<td colspan="2"><div align="left">
<input name="title" type="text" id="title" size="50">
<font color="#FF0000">*</font></div></td>
</tr>
<tr>
<td height="155"><p>留言内容</p>
<p>(留言内容不少于20个字) </p></td>
<td colspan="2" align="center"> <div align="left">
<textarea name="content" cols="58" rows="10" id="content"></textarea>
<font color="#FF0000">*</font></div></td>
</tr>
<tr>
<td align="right">验证码:</td>
<td height="30"><input name="code" type="text" id="code" size="12">
<img id="codeimg" src="producedCode.jsp"> <span class="line" style="cursor:hand" onClick="document.getElementById('codeimg').src='producedCode.jsp?tmp='+Math.random()">看不清</span></td>
</tr>
<tr>
<td height="25" colspan="3"> <div align="center">
<input type="submit" name="ly" s="button" id="ly" value="发表留言 " onClick="check(email)">
<input type="reset" name="Submit2" value="重置">
</div>
<div align="center"></div></td>
</tr>
</table>
</form>
</div>
<div id="apDiv5"><br />
<br />
</a><a href="../WebRoot/myWeb/untitled/web/index.html">首页<br />
<br />
<br />
<br />
<br />
<br />
</div>
</body>
</html>
<script language="VBScript">
sub bb()
form1.img.src=document.form1.tou.value
end sub
</script>
<script language="javascript">
function check(objEmail)
{
if(form1.user.value=="")
{
alert("姓名不能为空!")
form1.user.focus();
return false;
}
if(form1.title.value=="")
{
alert("标题不能为空!")
form1.title.focus();
return false;
}
if(from1.content.value.length<20)
{
alert("回复内容必须大于二十个字符")
return false;
}
if(form1.content.value=="")
{
alert("内容不能为空!")
form1.content.focus();
return false;
}
if(!/^\w+@\w+(\.\w+){1,3}$/.test(objEmail.value)){
alert('邮箱格式不对! !');
objEmail.focus();
return false
}
return true;
}
</script>