jsp页面问题 急用帮忙解决一下吧

小鸡快跑 发布于 2011/10/28 23:49
阅读 161
收藏 0

jsp页面:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

 


<html>
  <head>
  
   
    <title>pagecontext对象演示</title>
   
 

  </head>
 
  <body>
  <h1 align="center">对象演示</h1>
   <hr color="red" size="5" >
   <%
 String  app;
   int count;
  
   Enumeration attributes=PageContext.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE);
   while(attributes.hasMoreElements())
   {
   count+=1;
   app=(String)attributes.nextElement();
   out.print("application属性"+count+":"+app+"<br>");
  
   }
   %>
  
  </body>
</html>

运行结果:

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 23 in the jsp file: /pagecontext.jsp
Cannot make a static reference to the non-static method getAttributeNamesInScope(int) from the type JspContext
20:  String  app;
21:    int count;
22:   
23:    Enumeration attributes=PageContext.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE);
24:    while(attributes.hasMoreElements())
25:    {
26:    count+=1;


加载中
0
Sam_yi
Sam_yi
getAttributeNamesInScope  不是静态的吧
小鸡快跑
请问怎么修改呢?
0
小鸡快跑
请问怎么修改呢?谢谢
返回顶部
顶部