实在是不会呀,
D:/Log.mdb 文件,里面有两列,一个是name是主键,另一个是password。
写一个confirm.jsp文件,读取用户输入的name和password,和数据库中的匹配,在数据库中能匹配就转到index.jsp页面,否则就提示错。(能有注册功能就最最好了)
谢谢大家了,本人刚入门,介绍的越简单越好,谢谢了 :)
D:/Log.mdb 文件,里面有两列,一个是name是主键,另一个是password。
写一个confirm.jsp文件,读取用户输入的name和password,和数据库中的匹配,在数据库中能匹配就转到index.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">
<title>Untitled Document</title>
</head>
<body>
<center>
<table>
<form method="post" action="mm2.jsp">
<tr>
<td>班级</td>
<td><input type="text" name="class1" size=20> </td>
</tr>
<tr>
<td>密码</td>
<td><input type="text" name="name" size=20></td>
</tr>
<tr>
<td ><input type="submit" name="username" VALUE="submit" size=14></td>
</tr>
</form>
<table>
</center>
</body>
</html>
------------------------------------------------------------------------------
mm2.jsp接收
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*,java.util.Date"%>
<html>
<head>
<style>
<!--
tr {font-size:10pt}
body {font-size:10pt}
a:link {color:blue;text-decoration:none}
a:visited {color:blue;text-decoration:none}
a:active {color:red;text-decoration:none}
a:hover {color:red;text-decoration:underline}
-->
</style>
<title>数据库中记录分页显示实例</title>
</head><body bgcolor=LightBlue>
<%
//try
//{
//加载驱动程序
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//建立与ACCESS数据库,数据源名称为classdate
//ACCESS数据库没有设定用户名和密码
Connection con=DriverManager.getConnection("jdbc:odbc:classdate");
//建立Statement对象
Statement statement=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs=null;
%>
<table width="416" border="1" bordercolor=RoyalBlue align="center" bgcolor=lightblue>
<tr align="center">
<td bgcolor=lightblue width=69 >班级</td>
<td bgcolor=lightblue width=125 >姓名</td>
<td bgcolor=lightblue width=200 >总分</td>
</tr>
<%
String class1=new String(request.getParameter("class1").getBytes("ISO8859_1"),"GBK");
String name=new String(request.getParameter("name").getBytes("ISO8859_1"),"GBK");
rs=statement.executeQuery("select * from classdate where class1='"+class1+"' and name='"+name+"'");
while(rs.next())
{
out.println("<tr align=center>");
out.println("<td width=150>"+rs.getString("class1")+"</td>");
out.println("<td width=50>"+rs.getString("name")+"</td>");
out.println("<td width=150>"+rs.getString("count")+"</td>");
} rs.close();
statement.close();
con.close();
%>
</table></body>
</html>