2
回答
jsp页面问题 急用帮忙解决一下吧
华为云实践训练营,热门技术免费实践!>>>   

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;


<无标签>
举报
小鸡快跑
发帖于6年前 2回/148阅
顶部