Jsp连接数据库问题
<%@pagelanguage="java"import="java.util.*"pageEncoding="gbk"%><!DOCTYPEHTMLPUBLIC"-//...
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<%
/**
//接收用户名和密码 完成对用户的验证
if(u.equals("liyadong")&&p.equals("123")){
//合法
//传递参数 1、cookie 2、session 3、response.sendrendRedirect
response.sendRedirect("Wel.jsp?userN="+u);
}else{
response.sendRedirect("Login.jsp");
}
*/
String u = request.getParameter("username");
String p = request.getParameter("passwd");
System.out.println("niiaood");
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection ct=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","sys","wyhhxxsjhf");
%>
</body>
</html>
在这个地方Connection ct=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","sys","wyhhxxsjhf"); 报一个Multiple annotations found at this line:
- DriverManager cannot be resolved
- Connection cannot be resolved to a type错误 而且 在这句话 中DriverManager后面点点出不来提示 高手指点 展开
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<%
/**
//接收用户名和密码 完成对用户的验证
if(u.equals("liyadong")&&p.equals("123")){
//合法
//传递参数 1、cookie 2、session 3、response.sendrendRedirect
response.sendRedirect("Wel.jsp?userN="+u);
}else{
response.sendRedirect("Login.jsp");
}
*/
String u = request.getParameter("username");
String p = request.getParameter("passwd");
System.out.println("niiaood");
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection ct=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","sys","wyhhxxsjhf");
%>
</body>
</html>
在这个地方Connection ct=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","sys","wyhhxxsjhf"); 报一个Multiple annotations found at this line:
- DriverManager cannot be resolved
- Connection cannot be resolved to a type错误 而且 在这句话 中DriverManager后面点点出不来提示 高手指点 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询