我写了两个jsp文件,login.jsp 和subscription.jsp,我想用前者调用后者,但后者报错
org.apache.jasper.JasperException: unable to compile JSP class:
An error occurred at line: 6 in the generated java file
Only a type can be imported. com.mysql.jdbc.Statement resolves to a package
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:446)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
subscriptionform的代码如下
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="com.mysql.jdbc.Statement"%>
<!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">
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Inscription</title>
</head>
<body>
<script type="text/javascript">
function checkpwd(){
var l=document.inscription.login.value;
var m=document.inscription.mail.value;
var p1=document.inscription.password.value;
var p2=document.inscription.password2.value;
if(l=="" ||l == null ){
alert("entrer le login");
document.inscription.login.focus();
return false;
}
if(m=="" ||m == null ){
alert("entrer le mail");
document.inscription.login.focus();
return false;
}
if(p1==""||p1 == null ){
alert("entrer le mot de pass");
document.inscription.password.focus();
return false;
}
if(p2==""||p2 == null ){
alert("entrer le mot de pass");
document.inscription.password.focus();
return false;
}
if(p1 != p2){
alert("reperer votre mot de passe");
document.inscription.password.focus();
return false;
}
}
</script>
<div id="page">
<%@ include file="header.html"%>
<div id="main">
<div class="main_top">
<h1>Inscription</h1>
</div>
<div class="main_body">
<form name="inscription" action="inscription.jsp" method="post">
login:<input type="text" name = "login" size=15><br/>
mail:<input type="text" name="mail" size=15><br/>
mot de passe: <input type="password" name = "password" size=15><br/>
confirmer votre mot de passe: <input type="password" name = "password2" size=15 onchange="checkpwd()"><br /></input>
<input type="submit" value="inscrire"></input>
</form>
</div>
<%@ include file="footer.html"%>
</div>
</div>
</body>
</html>
求大神帮忙!!!!!
------解决方案--------------------
你的subscription.jsp页面报错了!
看看是不是导入com.mysql.jdbc.Statement的问题。
换成java.sql.Statement试试!
------解决方案--------------------
mysql 驱动包在吗
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
------解决方案--------------------
你应该把jar放在你工程的lib目录下!