郁闷死哦,代码是没问题的(教材上的源代码),
我估计 是我机器配置问题吧 烦死人呢 这搞不定
数据库都不好连了 请高手过来看看 什么问题啊
我把错误提示贴出来:
HTTP Status 500 - type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.
index.jsp代码如下:
<%@ page contentType="text/html; charset=gb2312" %>
<html>
<body>
<center>
<form name="form1" method="post" action="login.jsp">
<TABLE border=0 cellPadding=0 cellSpacing=0>
<TR>
<TD colspan="3" align="center">请输入姓名密码:</TD>
</TR>
<TR>
<TD height=16 colspan="3"></TD>
</TR>
<TR>
<TD > 用户名:</TD>
<TD colspan="2"><INPUT name=username size="31" maxLength=50></TD>
</TR>
<TR>
<TD height=16 colspan="3"></TD>
</TR>
<TR>
<TD >密 码:</TD>
<TD colspan="2"><INPUT name=password size="31" maxLength=50></TD>
</TR>
<TR>
<TD height=16 colspan="3"></TD>
</TR>
<TR>
<TD >身 份:</TD>
<TD colspan="2">
<input name="select" type="radio" value="student" checked> 学生
<input type="radio" name="select" value="teacher">教师
<input type="radio" name="select" value="administrator">管理员</TD>
</TR>
<TR>
<TD height=16 colspan="3"></TD>
</TR>
<TR>
<TD height=13 colspan="3"></TD>
</TR>
<TR>
<TD ></TD>
<TD><input type="Submit" value="登录" ></TD>
<TD ><input type="Reset" value="复位"></TD>
</TR>
</TABLE>
</form>
</center>
</body>
</html>
login.jsp代码如下:
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import="java.sql.*" %>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<html>
<head>
<title>
身份验证
</title>
</head>
<body bgcolor="#ffffff">
<%
String user=request.getParameter("username");
String pwd=request.getParameter("password");
String select=request.getParameter("select");
if(user.equals("stu")&&pwd.equals("stu")&&select.equals("student"))
response.sendRedirect("stu.jsp");
if(user.equals("tea")&&pwd.equals("tea")&&select.equals("teacher"))
response.sendRedirect("tea.jsp");
if(user.equals("admin")&&pwd.equals("admin")&&select.equals("administrator"))
response.sendRedirect("admin.jsp");
else response.sendRedirect("error.jsp");
%>
</body>
</html>
stu.jsp代码如下:
<%@ page contentType="text/html; charset=GB2312" %>
<html>
<head>
<title>
stu
</title>
</head>
<body bgcolor="#ffffff">
<h1>
welcome to stu.jsp
</h1>
</body>
</html>
tea.jsp代码如下:
<%@ page contentType="text/html; charset=GB2312" %>
<html>
<head>
<title>
tea
</title>
</head>
<body bgcolor="#ffffff">
<h1>
welcome to tea.jsp
</h1>
</body>
</html>
admin.jsp代码如下:
<%@ page contentType="text/html; charset=GB2312" %>
<html>
<head>
<title>
admin
</title>
</head>
<body bgcolor="#ffffff">
<h1>
welcome to admin.jsp
</h1>
</body>
</html>
error.jsp代码如下
<%@ page contentType="text/html; charset=GB2312" %>
<html>
<head>
<title>
error
</title>
</head>
<body bgcolor="#ffffff">
<h1>
this is error page
</h1>
</body>
</html>