日期:2014-05-20  浏览次数:20774 次

麻烦大家帮我看看这个jsp页面错在哪里了?
这是一个登录页面
源代码:
<%@ page contentType="text/html;charset=gb2312" language="java" import="java.lang.*,java.io.*,java.sql.*,java.util.*" errorPage=""%>
<jsp:useBean id="ISO2GB" scope="page" class="community.ISO2GB"/>
<html>
<head>
<title>登录页面--结果</title>
</head>
<body>

<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseNam=stu";
String user="sa";
String password="369";

Connection conn=DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);

String name=ISO2GB.convert(request.getParameter("name"));
String pw=request.getParameter("pw");
String sql="select * from comm";
ResultSet rs=stmt.executeQuery(sql);

while(rs.next())
{
String SQLName =rs.getString("userName");
String SQLPassw =rs.getString("userPassword");

if(name.equals(SQLName) && pw.equals(SQLPassw))
{
%>
<jsp:forward page="LoginEND.jsp">
<jsp:param name="urXy" value="<%=name%>"/>
</jsp:forward>
<%
}
else
{
%>
<jsp:forward page="LoginERROR.jsp">
<jsp:param name="userXy" value="<%=name%>"/>
</jsp:forward>

<%
}
}

  rs.close();
  stmt.close();
  conn.close();
%>

</body>
</html>



Tomcat 报错:(红色)

HTTP Status 500 - type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: userPassword
 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
 org.apache.jsp.LoginOK_jsp._jspService(org.apache.jsp.LoginOK_jsp:119)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: userPassword
 com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
 com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
 com.microsoft.jdbc.base.BaseResultSet.getColumnOrdinal(Unknown Source)
 com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)
 org.apache.jsp.LoginOK_jsp._jspService(org.apache.jsp.LoginOK_jsp:79)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.Apache Tomcat/5.5.9