我正在尝试使用JSP使用我的数据库,我是JSP的新手,但我熟悉JAVA langauge。我得到了以下代码的以下错误:
Multiple annotations found at this line:
- java.sql.Connection cannot be resolved to a
variable
这是代码:
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Login check</title>
</head>
<body>
<%
String username = request.getParameter("username");
String password = request.getParameter("password");
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/jspexample", "root", "");
%>
</body>
</html>
答案 0 :(得分:0)
我发现IDE中有一个错误,所以我尝试编译它,一切都运行良好。