对了忘了说了编译时错误是:
org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 16 in the jsp file: /login.jspGenerated servlet error:
    [javac] Compiling 1 source fileC:\Tomcat 4.1\work\Standalone\localhost\myapp\login_jsp.java:65: 'else' without 'if'
else{
An error occurred at line: -1 in the jsp file: nullGenerated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\myapp\login_jsp.java:120: '}' expected
^
C:\Tomcat 4.1\work\Standalone\localhost\myapp\login_jsp.java:31: 'try' without 'catch' or 'finally'
    try {
    ^
3 errors好了拜托大家了!

解决方案 »

  1.   

    1.
    if(n==0){//////////////////////////////////
    %>
    <p>请输入完整的密码和用户名</p>
    <p><a href="index.jsp">返回</a></p>
    <%
    else{/////////////////////////////////////else前面的if的大括号没有闭合
    String tempuser = new String();
    String tempname = new String();
    String url = new String();
      

  2.   

    在使用jdk1.4版时,您必须引入
    import java.sql.Statement;
    就对了,它有方法覆盖.
      

  3.   

    2.
    if( rs.nest()){
    tempname=rs.getString("username");
    catch(SQLException ex){
    System.out.println("err:"+ex.getMessage());
    }
    }
    else///////////////////////////////////不知道这个else放在这里干什么,没什么作用就应该去掉或者写成else{}(非要保留的话)
      
      这样的错误自己留心检查吧,你的代码有可能不只三个错误,其他的错误有可能被这三个错误隐藏了。代码书写要规范,注意正确的缩进,这样才能使括号的层次分明。你的第三个错误看看错误提示就知道问题出在哪里了。自己找一下吧。
      

  4.   

    userid="+use_id+"and "+use_sn="+userpassword+";
    这句话有错。
    ^_^
      

  5.   

    你的程序风格太差了,“{}”配对有很大的问题,尤其是下面这段代码:
    try{
    sql="select * from chatroomuser where userid="+use_id+"and "+use_sn="+userpassword+";
    ResultSet rs = stmt.executeQuery(sql);
    if( rs.nest()){
    tempname=rs.getString("username");
    catch(SQLException ex){
    System.out.println("err:"+ex.getMessage());
    }
    }
    else
    %>
      

  6.   

    建议写成这样的形式
    .....
    {
       if(...)
       {
        .....
        }else
       {
        .....
        }
    }