📄 edit.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<script language="javascript">
function checknum(){
if(eform.ID.value=="")
window.alert("填写ID","警告信息");
else
if(eform.name.value=="")
window.alert("填写姓名","");
else
if(eform.age.value=="")
window.alert("填写年龄","");
else
if(eform.addr.value=="")
window.alert("填写地址","");
else
if(eform.tel.value=="")
window.alert("填写电话","");
else
eform.submit();
}
</script>
<%@ include file="check.jsp" %>
<p></p>
<form method="POST" action="edit2.jsp" name="eform">
<%
//String ID=request.getQueryString();
// String id=id.subSequence(3,ID.length());
String id=request.getParameter("id");
%>
<%=id%>
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection dbcon=DriverManager.getConnection("jdbc:odbc:yang");
PreparedStatement stat=dbcon.prepareStatement(
"select * from y1 where id=?"); //and name=? and age=? and addr=? and tel=?");
stat.setString(1,id);
// stat.setString(2,name);
// stat.setString(3,age);
// stat.setString(4,addr);
// stat.setString(5,tel);
ResultSet result=stat.executeQuery();
%>
<%
while(result.next())
{
%>
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p>ID* <!--webbot
bot="Validation" S-Data-Type="Number" S-Number-Separators=",."
S-Validation-Constraint="Greater than or equal to" S-Validation-Value="1"
S-Validation-Constraint="Less than" S-Validation-Value="99999" -->
<input name="ID" type="text" size="20" maxlength="4" value="<%=result.getString(1)%>">
</p>
<p>姓名 <!--webbot bot="Validation"
S-Data-Type="String" B-Value-Required="TRUE" I-Minimum-Length="2"
I-Maximum-Length="4" --> <input name="name" type="text" size="20" maxlength="4">
</p>
<p>年龄 <!--webbot bot="Validation"
S-Data-Type="Integer" S-Number-Separators=","
S-Validation-Constraint="Greater than or equal to" S-Validation-Value="1"
S-Validation-Constraint="Less than or equal to" S-Validation-Value="100" --> <input name="age" type="text" size="20" maxlength="2">
</p>
<p>地址 <!--webbot bot="Validation"
S-Data-Type="String" B-Value-Required="TRUE" I-Minimum-Length="2"
I-Maximum-Length="20" --> <input name="addr" type="text" size="20" maxlength="20">
</p>
<p>电话 <!--webbot bot="Validation"
S-Data-Type="Number" S-Number-Separators=",." B-Value-Required="TRUE"
I-Minimum-Length="8" I-Maximum-Length="11" -->
<input name="tel" type="text" size="20" maxlength="16">
</p>
<p>
<%
}
%>
</table>
<%
}
catch(Exception e)
{
out.println(e);
}
%>
<input type="button" value="提交" name="B1" onClick="checknum()"><input type="reset" value="全部重写" name="B2"></p>
</form>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -