就看你使用了哪些外部的东西了。如:数据库JDBC的连接类之类的

解决方案 »

  1.   

    我写了一个javabean,不过运行的时候老是提示错误,大家帮帮忙看看(已经编译过放在classes里面):
    import java.io.*;public class TestBean implements java.io.Serializable
    {
    int price;
    String description; public TestBean()
    {
    } void setPrice(int p)
    {
    price = p;
    } void setDescription(String s)
    {
    description = s;
    } public int getPrice()
    {
    return price;
    } public String getDescription()
    {
    return description;
    }
    }我调用的时候用:<jsp:useBean id="test" class="TestBean" />
    就是老是报错。
      

  2.   

    错误如下:
    org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 11 in the jsp file: /index.jsp
    Generated servlet error:
    I:\Program Files\Tomcat 5.0\work\Catalina\localhost\mine\org\apache\jsp\index_jsp.java:55: cannot resolve symbol
    symbol  : class TestBean 
    location: class org.apache.jsp.index_jsp
          TestBean test = null;
          ^
    An error occurred at line: 11 in the jsp file: /index.jsp
    Generated servlet error:
    I:\Program Files\Tomcat 5.0\work\Catalina\localhost\mine\org\apache\jsp\index_jsp.java:57: cannot resolve symbol
    symbol  : class TestBean 
    location: class org.apache.jsp.index_jsp
            test = (TestBean) _jspx_page_context.getAttribute("test", PageContext.PAGE_SCOPE);
                    ^
    An error occurred at line: 11 in the jsp file: /index.jsp
    Generated servlet error:
    I:\Program Files\Tomcat 5.0\work\Catalina\localhost\mine\org\apache\jsp\index_jsp.java:59: cannot resolve symbol
    symbol  : class TestBean 
    location: class org.apache.jsp.index_jsp
              test = new TestBean();
                         ^
    An error occurred at line: 14 in the jsp file: /index.jsp
    Generated servlet error:
    I:\Program Files\Tomcat 5.0\work\Catalina\localhost\mine\org\apache\jsp\index_jsp.java:71: cannot resolve symbol
    symbol  : class TestBean 
    location: class org.apache.jsp.index_jsp
          out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((TestBean)_jspx_page_context.findAttribute("test")).getDescription())));
                                                                            ^
    4 errors不知道是不是web.xml配置的问题。我是把ROOT\WEB-INF里面的web.xml直接拷贝过来的,是不是这样不行,要自己写?