程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> JSP編程 >> 關於JSP >> 簡易成績查詢系統

簡易成績查詢系統

編輯:關於JSP

先建一個數據庫(std.mdb):其中有兩個表 1.pw(密碼表) 2.score成績表
然後建兩個Jsp文件
enter.jsp(登錄頁面,用來驗正身份的)
-----------------------------------------------
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<title>個人成績查詢登錄</title>
<body>
<center>
<font color=blue size=4><b><i>
請輸入你的學號和密碼</b></i>
</font>
<hr>
<form action="result.jsp" method="post">
<table border="1">
<tr><th bgcolor="yellow">學號</th><td>
<input type="text" size=10 name="number"></td></tr>
<tr><th bgcolor="yellow">密碼</th><td>
<input type="password" size=10 name="password"></td></tr>
<tr><td colspan="2" align="center">
<input type="submit" vaule="查詢"></td></tr>
</table>
</form>
<font color="red">
<%
String error=request.getParameter("errortype");
if(error!=null)
{
int errortype;
errortype=Integer.parseInt(error);
switch(errortype)
{
case 1:out.println("請輸入學號!");break;
case 2:out.println("請輸入密碼!");break;
case 3:out.println("搞錯,沒有此人!");break;
case 4:out.println("密碼錯誤!");break;
default:
}
}
%>
</font>
</body>
</html>
result.jsp(執行查詢結果)
--------------------------------------------
<html>
<title>查詢結果</title>
<body>
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*" %>
<%
String num=request.getParameter("number");
String password=request.getParameter("password");
int errortype=0;
if(num.equals(""))
{
errortype=1;
response.sendRedirect("enter.jsp?errortype="+errortype);

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved