错误信息如下:org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
    [javac] Compiling 1 source fileC:\Tomcat\work\Standalone\localhost\_\action_jsp.java:80: illegal character: \11
try {
                   ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:80: 'try' without 'catch' or 'finally'
try {
                ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:87: 'else' without 'if'
else if (password.regionMatches(0,temp_password,0,password.length()))
                ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:89: 'else' without 'if'
else out.println("wrong,retry");
                ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:91: 'catch' without 'try'
} catch (Exception e)
                  ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:60: 'try' without 'catch' or 'finally'
try{
        ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:63: cannot resolve symbol
symbol  : class Connection  
location: class org.apache.jsp.action_jsp
Connection con=DriverManager.getConnection(url,"haibo","haibo");
                ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:63: cannot resolve symbol
symbol  : variable DriverManager  
location: class org.apache.jsp.action_jsp
Connection con=DriverManager.getConnection(url,"haibo","haibo");
                               ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:64: cannot resolve symbol
symbol  : class PreparedStatement  
location: class org.apache.jsp.action_jsp
PreparedStatement select_stm=con.prepareStatement("select password from tab1 where userId=?");
                ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:66: cannot resolve symbol
symbol  : class ResultSet  
location: class org.apache.jsp.action_jsp
   ResultSet result=select_stm.executeQuery();
           ^An error occurred at line: 14 in the jsp file: /action.jspGenerated servlet error:
C:\Tomcat\work\Standalone\localhost\_\action_jsp.java:76: cannot resolve symbol
symbol  : class PreparedStatement  
location: class org.apache.jsp.action_jsp
PreparedStatement insert_stm=con.prepareStatement("insert into tab1 values(?,?)");
                        ^
11 errors

解决方案 »

  1.   

    出错原因不是都告诉你了吗?
    比如第一个就是 'try' without 'catch' or 'finally';
    使用try的话,至少要有一个catch或finally,
    你应该看的懂得啊
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <%@ page language="java"  %>
    <a@ page import="java.sql.*"%>  <==============<%@ page import="java.sql.*"%><html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    <% 
    String userId=request.getParameter("userId");
    String password=request.getParameter("password");
    %>
       
       <%
    if ((userId.length()==0)||(password.length()==0))
    out.println("密?和用?不能?空");
    else

    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url="jdbc:odbc:mydb";
    Connection con=DriverManager.getConnection(url,"haibo","haibo");
    PreparedStatement select_stm=con.prepareStatement("select password from tab1 where userId=?");
        select_stm.setString(1,userId);
       ResultSet result=select_stm.executeQuery();    String  temp_password=null;     if (result.next())
    temp_password=result.getString(1);
    result.close(); if (temp_password==null)
    {
    PreparedStatement insert_stm=con.prepareStatement("insert into tab1 values(?,?)"); <==========="tabl"应该是"table"吧?
    insert_stm.setString(1,userId);
    insert_stm.setString(2,password);

    try
    {
    insert_stm.executeQuery();
    }catch (Exception e)

    out.println("YOU are first login,success registe!");
    }

    else if (password.regionMatches(0,temp_password,0,password.length()))
    out.println("Right password,com in");
    else out.println("wrong,retry");

    } catch (Exception e) <===================这里少了一个 “{” out.println(e);  }
    %>
    </body>
    </html>漏了几个符号,呵呵
      

  3.   

    确实只是缺少符号的问题,不过还的谢谢:waterdragonfly(见到PLMM就脸红) ,就给你分吧,谢谢你看了我写的那些东西!