Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp 未找到适合jdbc的驱动程序:mysql://localhost:3306/finalproject_Jsp - Fatal编程技术网

Jsp 未找到适合jdbc的驱动程序:mysql://localhost:3306/finalproject

Jsp 未找到适合jdbc的驱动程序:mysql://localhost:3306/finalproject,jsp,Jsp,这是我的test.jsp代码 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="java.sql.*" import="java.io.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/T

这是我的test.jsp代码

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
import="java.sql.*"
import="java.io.*"
%>

<!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=ISO-8859-1">
    <title>Final Project</title>
</head>
<body>
    <center><h1>New Registration Page</h1></center>
    <table border="1" align="center">
        <tr>
            <td>
                <table border="0" align="center" cellpadding="1" cellspacing="1">
                    <tr>
                        <form action=Profile.jsp method="get">
                        <td>First Name*:</td> <!-- we need a button that says show profile then link it here -->
                        <td><input type="text" name="firstname"></td>
                    </tr>
                    <tr>
                        <td colspan="3"><center><input type="submit" value="Submit!"></center></td>
                        </form>
                    </tr> 
                </table>
            </td>
        </tr>
    </table>
</body>

最终项目
新注册页
姓名*:

此文件与profile.jsp连接。 提交test.jsp时,没有找到适合jdbc的驱动程序:mysql://localhost:3306/finalproject 错误来自于

<% 
Class.forName("java.sql.Connection");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/finalproject", "root", "vietforlife");
String firstname=request.getParameter("firstname");

        Statement statement = connection.createStatement();
        ResultSet resultset = statement.executeQuery("SELECT FirstName, LastName, Username, Password1, Password2, Email FROM userid WHERE FirstName = '"+firstname+"'"); 
%>

我认为我的数据库没有与jsp文件连接。 我遵循了类似问题的说明,但这不起作用。
你们能帮我个忙吗?

你们用错了驾驶者的学名
改变

看一看这本书

更新 它给出java.lang.ClassNotFoundException:com.mysql.jdbc.Driver错误

为了避免
ClassNotFoundException

你可以从

相关链接
使用

Class.forName("com.mysql.jdbc.Driver")

不要忘记为此包含jar文件。

如果我使用该文件,它会给出java.lang.ClassNotFoundException:com.mysql.jdbc.Driver错误。这就是为什么我将其更改为java.sql.connection。@user3069146:如果我的答案解决了您的问题,那么您可以将答案标记为已接受。参见
:3306
是可有可无的。
Class.forName("com.mysql.jdbc.Driver");  
Class.forName("com.mysql.jdbc.Driver")