我在浏览自己写的JSP页面的时候总是出现下面的错误提示:
Undefined variable or class name: application这是什么原因啊?
application是JSP的内置对象啊,应该可以直接用的吧?

解决方案 »

  1.   

    你这个好像和application无关,把代码附上来看一下
      

  2.   

    <%@page contentType="text/html"%><html>
    <head>
    <title>JSP APPLICATION COUNTER</title>
    </head>
    <body>
    <% 
    application.setAttribute("Counter",new Integer(0));

     %>
    <%!
    Integer i;
    synchronized void countPage(){
    Integer countNum=(Integer)application.getAttribute("Counter");
    countNum=new Integer(countNum.intValue()+1);
    application.setAttribute("Counter",countNum);
    }
     %>
     <% 
      i=new Integer(0);
      countPage();
      i=(Integer)application.getAttribute("Counter");
      %>
       
      WELCOME TO OUR SITE!<BR>
      YOU R THE <%= i.intValue() %> USER!
    </body>
    </html>
    这个就是代码,而且还是书上的...