我正在使用Netbeans。我已經創建用戶和密碼datatable。我有問題排除我的登錄名和密碼來訪問我的另一個jsp文件。它向我顯示HTTP狀態404 - 未找到。問題是什麼?從Datatable中檢索用戶名和密碼進行登錄
以下是我的logincheck.jsp
代碼:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page language="Java" import="java.sql.*" %>
<!DOCTYPE html>
<body>
<%
String username = request.getParameter("username");
String password = request.getParameter("password");
String userType = request.getParameter("usertype");
String driver = "oracle.jdbc.driver.localDriver";
String dbURL = "jdbc:derby://localhost:1527/Parts ";
String dbuser = "user";
String dbpassword = "password";
Connection theConnection = null;
PreparedStatement theStatement = null;
try {
Class.forName(driver);
theConnection=DriverManager.getConnection(dbURL,dbuser,dbpassword);
theStatement = theConnection.prepareStatement("select * from USERS");
theStatement.setString(1,request.getParameter("username"));
theStatement.setString(2,request.getParameter("password"));
ResultSet theResult = theStatement.executeQuery();
if(theResult.next())
System.out.println("welcome.jsp");
else
System.out.println("Failed");
}
catch(Exception e) {
System.out.println("Exception occured! "+e.getMessage()+" "+e.getStackTrace());
}
%>
</body>
404錯誤發生在哪裏? – Steve
它在HTTP 404上顯示狀態 - 未找到類型狀態報告消息未找到描述請求的資源不可用。我該怎麼辦? –
我的意思是錯誤發生在哪一行? – Steve