<%@ 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>
<style type="text/css">
<!--
body {
background-image: url(image/bg_002.gif);
}
-->
</style></head>
<body>
<%
String name=(String)request.getParameter("username");
String pass=(String)request.getParameter("userpass");
String s=(String)request.getParameter("userselect");
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
String loginNum="0";
session.setAttribute("lnum",loginNum);
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Conneaction conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:8080;DatabaseName=xuanke","sa","");
if(s.equals("1"))
{
String sql="select * from student where sId='"+name+"' and sPass='"+pass+"'";
stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
if(rs.next()) 
{
loginNum="1";
session.setAttribute("lnum",loginNum);
session.setAttribute("name",name);
out.print(name+"登陆成功,页面跳转........");
response.sendRedirect("student/studentIndex.html");
}
else 
{
out.print("用户名或密码有误..");
response.sendRedirect("index.jsp");
}
}
if(s.equals("2"))
{
String sql="select * from teacher where tId='"+name+"' and tPass='"+pass+"'";
stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
if(rs.next()) 
{
loginNum="2";
session.setAttribute("lnum",loginNum);
session.setAttribute("name",name);
out.print(name+"登陆成功,页面跳转........");
response.sendRedirect("teacher/teacherIndex.html");
}
else 
{
out.print("用户名或密码有误..");
response.sendRedirect("index.jsp");
}
}
if(s.equals("3"))
{
String sql="select * from admin where aId='"+name+"' and aPass='"+pass+"'";
stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
if(rs.next()) 
{
loginNum="3";
session.setAttribute("lnum",loginNum);
session.setAttribute("name",name);
out.print("管理员"+name+"登陆成功,页面跳转........");
response.sendRedirect("admin/adminIndex.html");
}
else 
{
out.print("用户名或密码有误..");
out.print("<a href=index.jsp>登陆页面</a>");
}
}
}
catch(Exception e){out.print(e);
//response.sendRedirect("index.jsp");
}
%>
</body>
</html>报错内容如下:
An error occurred at line: 15 in the jsp file: /user1/choosecourse/login.jsp
Generated servlet error:
Connection conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:8080;DatabaseName=xuanke","sa","");