日期:2014-05-18  浏览次数:20691 次

JSP新手问题
第一次接触JSP,照书上代码抄下,内容如下
<%@   page   contentType= "text/html;charset=GBK "%>
<%@   page   improt= "java.util.Date "%>
<html>
<head>
<title> Page指令示例 </title>
</head>
<body>
<h2>
使用page指令插入导入 "java.util.Date "
</h2>
<%
        Date   date=new   Date();
        out.println( "Time:   "+date);
%>
</body>
</html>
保存为data.jsp.然后保存,并入到了webapps\ROOT,目录下,在然后在IE中输入http://localhost:8735/data.jsp,(8735是Tomcat的端口号),回车,出现如下错误,大家指教一下,谢谢

HTTP   Status   500   -  

---------------------------------------
-----

type   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

org.apache.jasper.JasperException:   org.apache.jasper.JasperException:   Unable   to   load   class   for   JSP
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:154)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
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)


root   cause  

org.apache.jasper.JasperException:   Unable   to   load   class   for   JSP
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:600)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:142)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
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)


root   cause  

java.lang.ClassNotFoundException:   org.apache.jsp.data_jsp
java.net.URLClassLoader$1.run(Unknown   Source)
java.security.AccessController.doPrivileged(Native   Method)
java.net.URLClassLoader.findClass(Unknown   Source)
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:142)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
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)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/6.0.10   logs.