当前位置:编程学习 > JAVA >>

在页面跳转时出现这样的代码 用的是pl/sql jdbc-oracle

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 29 in the generated java file
Syntax error, insert "}" to complete ClassBody

An error occurred at line: 49 in the jsp file: /wel.jsp
Duplicate local variable rs
46:      //3.创建Statement
47:      Statement sm=ct.createStatement();
48:      //4.查询
49:      ResultSet rs=sm.executeQuery("select count(*) from users ");
50:     
51:      if(rs.next())
52:      {


An error occurred at line: 197 in the generated java file
Syntax error, insert "else Statement" to complete IfStatement

An error occurred at line: 197 in the generated java file
Syntax error, insert "}" to complete Block

An error occurred at line: 197 in the generated java file
Syntax error, insert "}" to complete Block

An error occurred at line: 208 in the generated java file
Syntax error on token "}", delete this token

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:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:326)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.32 logs.

Apache Tomcat/6.0.32 java --------------------编程问答-------------------- <%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'wel.jsp' starting page</title>
    
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

  </head>
  
  <body>
    登录成功!恭喜恭喜!<%=request.getParameter("user")%><br>
  <a href="login.jsp">返回重新登录</a>
  <hr>
  <h1>用户信息列表</h1>
  <%
  
  int pageSize=3;
  int pageNow=1;
  int rowCount=0;
  int pageCount=0;
  
    //1.加载驱动
    Class.forName("oracle.jdbc.driver.OracleDriver");
    //2.得到链接
    Connection ct=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:ORCL","scott","m123");
    //3.创建Statement
    Statement sm=ct.createStatement();
    //4.查询
    ResultSet rs=sm.executeQuery("select count(*) from users ");
   
    if(rs.next())
    {
       rowCount=rs.getInt(1);
    }
    
    if(rowCount%pageSize==0)  {
        
        pageCount=rowCount/pageSize;
    }
    else  {
    
        pageCount=rowCount/pageSize+1;
    }
    
    rs=sm.executeQuery("select top "+pageSize+" * from users where userId not in (select top "+pageSize*(pageNow-1)+" userId from users) ");
    
    %>
    <table border="1">
    <tr><td>用户id</td><td>用户名字</td><td>密码</td><td>电邮</td><td>级别</td></tr>
    <%
    while(rs.next())
    {
       %>
   <tr><td><%=rs.getInt(1) %></td><td><%=rs.getString(2) %></td><td><%=rs.getString(3) %></td><td><%=rs.getString(4) %></td><td><%=rs.getInt(5) %></td></tr>
      <%
    }
    
     %>
    </table>
    <%
    
    
   %>
  
  </body>
  <hr>
</html>
补充:Java ,  Java SE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,