问题描述
我的代码是这样的:packagebean;publicclassCounter{publicCounter(){}privateintCount=0;publicvoidsetCounter(intcount){Count=count;}publicintgetCounter(){return++Count;}}JSP页面时这样的:<%@pagelanguage="java"import="java.util.*"pageEncoding="UTF-8"%><body><jsp:useBeanid="count"scope="page"calss="bean.Counter"></jsp:useBean>您是本站第<jsp:getPropertyname="count"property="counter"></jsp:getProperty>位参观者!</body></html>然后运行的时候总是报错,不知为啥?报错:HTTPStatus500---------------------------------------------------------------------------------typeExceptionreportmessagedescriptionTheserverencounteredaninternalerror()thatpreventeditfromfulfillingthisrequest.exceptionorg.apache.jasper.JasperException:org.apache.jasper.JasperException:UnabletoloadclassforJSPorg.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:156)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rootcauseorg.apache.jasper.JasperException:UnabletoloadclassforJSPorg.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:600)org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rootcausejava.lang.ClassNotFoundException:org.apache.jsp.index_jspjava.net.URLClassLoader$1.run(URLClassLoader.java:200)java.security.AccessController.doPrivileged(NativeMethod)java.net.URLClassLoader.findClass(URLClassLoader.java:188)org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598)org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)javax.servlet.http.HttpServlet.service(HttpServlet.java:803)noteThefullstacktraceoftherootcauseisavailableintheApacheTomcat/6.0.13logs.
解决方案
解决方案二:
<jsp:useBeanid="count"scope="page"class="bean.Counter"></jsp:useBean>
解决方案三:
你userBean的class写错了