HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: /test.jsp(1,4) Invalid directive
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:90)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:506)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
--------------------------------------------------------------------------------Apache Tomcat/5.0.28
怎么解决啊~是由于什么问题导致的?

解决方案 »

  1.   

    /test.jsp(1,4) Invalid directive
      

  2.   

    //DBConnectionBean.java
    //用在JSP网页里的数据库桥接Bean
    package examinline;
    import java.util.*;
    import java.sql.*;
    import java.io.*;
    public class ConnectionBean{    //成员变量初始化
    //定义变量并初始化
    Connection dbcon=null;//数据库连接
    Ststement stmt=null;//JDBC声明
    Resultset result=null;//记录集
    String driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";//数据库驱动程序
    String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dwl";//连接字符串
    String user="sa";//用户名
    String password="sa";//密码
    //读取配置文件
    public ConnectionBean(){
    try{
    //配置输入流读取配置文件
    InputStream fis =getClass().getResourceAsStream("jdbcsql.properties");
    //读取数据库配置文件
    Properties ps=new Properties();
    ps.load(fis);
    //读取配置文件参数
    driver=ps.getProperty("driver");
    url=ps.getProperty("url");
    user=ps.getProperty("user");
    password=ps.getProperty("password");
    //数据库驱动程序
    Class.forName(this.driver);
    }
    catch(Exception e){
    //这样写是为了方便调试程序,出错打印e就知道在什么地方出错了
    System.out.printin(e);
    }
    }
    //设置驱动程序
    public viod setdrivername()
    {
    try{
    Class.forName(this.driver);//注册数据库驱动程序
    //输出结果,方便调试
    System.out.printin("加载数据驱动成功!");
    }catch(ClassNotfoundException e){
    //抛出异常,加载数据驱动失败
    System.out.println("jdbc driver error");
    }
    }
    //打开连接
    public Connection getopenConnection()
    {
    try{
    //建立数据库连接
    this.dbcon=DriverManager.getConnection(this.url,this.user,this.password);
    System.out.println("桥接数据库成功!");
    }catch(SQLException e2){
    //异常处理
    System.out.println(e2);
    }
    return dbcon;
    }
    //executeQuery方法用于进行记录的查询操作
    //入口参数为sql语句,返回ResultSet对象
    public ResultSet executeQuery(String query)throws SQLException{
    //创建一个jdbc声明
    this.stmt=dbcon.createStatement();
    //执行指令
    this.result=stmt.executeQuery(query);
    //获取SQL指令执行返回结果
    return result;
    }
    //executeUpdate 方法用于进行add或者update记录的操作
    //入口参数为SQL语句;成功返回true,否则为false
    public viod executeUpdate(String query)throws SQLException{
    //创建一个jdbc声明
    this.stmt=dbcon.createStatemt();
    //执行指令
    stmt.executeUptate(query);
    //操作成功时关闭声明
    if(stmt!=null)stmt.close();
      }
      //根据列号读取数据
      //入口参数为int型数据表列号,返回string型的数据
      public string getData(int index) throws SQLException{
           return result.getString(index);
      }
      //根据列号读取数据
      //入口参数为int型数据表列号,返回int型的数据  public int getInData(int index) throws SQLException{
          return result.getInt(index);
      }
      //根据列号读取数据
      //入口参数为int型数据表列号,返回float型的数据
      public float getFltData(int index) throws SQLException{
          return result.getFloat(index);
      }
      //判断数据库中的记录是否已到记录尾,返回值为boolean值
      //若已到记录尾,返回值为false,否则为true
      public boolean next() throws SQLException{
          return resultnext();
      }
      //清空SQL指令执行结果
      public void resetResult() throws SQLException{
          this.result=null;
      }
    //关闭数据库连接,关闭JDBC声明,清空结果
      public void close() throws SQLException
    {
                if(dbcon!=null) dbcon.close();
          if(stmt!=null) stmt.close();
        if(result!=null) result.close();
           }
           public void finalize() throws Throwable{
               this.close();
           }
           //系统公共函数,实现字符的替换
           public String replaceString(String str)
    {
               //转换入口参数string类型的str为数组
    char tempArray[]=str.toCharArray();
               int iCurr[]=new int[10];
               int j=0;
               for(int i=0;i!=tempArray.length;i++)
         {
                   int temp=(int)tempArray[i];
           if(temp==92){
                       iCurr[j]=i;
       j++;
           }
         }
    final int temp2=j+1;
    String strArray[]=new String[temp2];
    strArray[0]=str.substring(iCurr[j-1]+1);
    for(int m=1;m!=strArray.length-1;m++){
    strArray[m]=str.substring(iCurr[m-1],iCurr[m]);
    }
    str="";
    for(int k=0;k!=strArray.length-1;k++){
    str=str+strArray[k]+"%5C";
    }
    str=str+strArray[temp2-1];
    return str;
    }
    }————————————————————————————————————————
    编译成功运行出现以下问题
    Exception in thread"main"java.lang.NoSuchMethodError:main