这是错误提示:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 31 in the jsp file: /chujuan1.jsp
Generated servlet error:
Duplicate local variable sql
An error occurred at line: 31 in the jsp file: /chujuan1.jsp
Generated servlet error:
Duplicate local variable sql
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
这是代码:
<SCRIPT language= "javascript ">
function backward()
{
history.back();
}
function teacher()
{
window.location= "UntitledFrameset-5.htm ";
}
</SCRIPT>
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* " errorPage= " " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 添加成功 </title>
</head>
<body>
<%!
void randomNum(int a[],int i,int j)
{
a[i]=1+(int)(Math.random()*j);
for(int c=i-1;c> =0;c--)
{
if(a[i]==a[c])
randomNum(a,i,j);
}
}
%>
<%
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
String driver = "jdbc:odbc:try ";
String user= "sa ";
String password= " ";
Connection conn = DriverManager.getConnection(driver, "sa ", " ");
Statement stmt = conn.createStatement();
//读取表单内容
int shijuanbianhao=Integer.parseInt(request.getParameter( "shijuanbianhao "));
System.out.println( '1 ');
String sql= "SELECT * FROM shijuan where shijuanbianhao= "+shijuanbianhao;
System.out.println( '2 ');
ResultSet rs=stmt.executeQuery(sql);
System.out.println( '3 ');
if(rs.next())
{
int xuanzeshumu=Integer.parseInt(request.getParameter( "xuanzeshumu "));
int xuanzefenzhi=Integer.parseInt(request.getParameter( "xuanzefenzhi "));
int panduanshumu=Integer.parseInt(request.getParameter( "panduanshumu "));