求助啊 我刚编了一个程序 <%@ page contentType="text/html;charset=GB2312"%>
<html> <body> <p>现在时间是: <%! synchronized void countPeople() { ServletContext application=getServletContext(); Integer number=(Integer)application.getAttribute("Count"); if(number==null) { number=new Integer(1); application.setAttribute("Count",number); } else { number=new Integer (number.intValue()+1); application.setAttribute("Count",number); } } %> <% if(session.isNew()) { countPeople(); Integer myNumber=(Integer)application.getAttribute("Count"); session.setAttribute("MyCount",myNumber); } %> <p><p>你 是 第 <% int a=((Integer)session.getAttribute("MyCount")).intValue(); %> <%=a%> 个访问本站的客户! </body> <html>
是一个计数器程序,可出现这么一个错误
exception org.apache.jasper.JasperException org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372) 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)
root cause java.lang.NullPointerException org.apache.jsp.time1_jsp._jspService(time1_jsp.java:79) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) 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)有哪位高手给指点一下啊!!!谢谢~~~