📄 test.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" import="java.sql.*" language="java" %>
<% request.setCharacterEncoding("gb2312");%>
<!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>JSP+JavaBean</title>
<jsp:useBean id="user" class="com.proreg.user" scope="request"/>
<jsp:useBean id="dbcon" class="com.proreg.dbcon" scope="page"/>
<jsp:setProperty name="user" property="*"/>
</head>
<body>
<table width="80%" height="36" align="center">
<tr>
<td height="30" align="center"><h2>注册成功</h2></td>
</tr>
</table>
<hr>
<table width="500" border="1" align="center">
<%
Statement stmt=dbcon.getStmt();
int temp=stmt.executeUpdate("INSERT INTO Test1(infant,name,sex,birth,work,tel) VALUES('"+
user.getInfant()+"','"+user.getName()+"','"+user.getSex()+"','"+user.getBirth()+"','"+
user.getWork()+"',"+user.getTel()+")");
if(temp>0){
%>
<tr align="center">
<td width="39%" height="27">呢 称:</td>
<td width="61%" height="27"><jsp:getProperty name="user" property="infant"/>
</td>
</tr>
<tr align="center">
<td height="27">真实姓名:</td>
<td width="61%" height="27"><jsp:getProperty name="user" property="name"/>
</td>
</tr>
<tr align="center">
<td height="27">性 别:</td>
<td height="27"><jsp:getProperty name="user" property="sex"/>
</td>
</tr>
<tr align="center">
<td height="27">出生日期:</td>
<td height="27"><jsp:getProperty name="user" property="birth"/>
</td>
</tr>
<tr align="center">
<td height="27">职 业:</td>
<td height="27"><jsp:getProperty name="user" property="work"/>
</td>
</tr>
<tr align="center">
<td height="27">电 话:</td>
<td height="27"><jsp:getProperty name="user" property="tel"/>
</td>
</tr>
<tr align="center">
<td height="27" colspan="2">恭喜你注册成功</td>
</tr>
<%
}else{
%>
<tr align="center">
<td height="27" colspan="2">你的注册失败</td>
</tr>
<%
}
dbcon.close();
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -