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.
[解决办法]
没有找到你这个文件
在你的/webapps 建一个工程吧 把这个文件在放进去
[解决办法]
improt= "java.util.Date " 这里错了
是import= " "; 以后细心点
------解决方案--------------------
你现下载一个Eclipse吧,不要忘记装JDK,然后下个MyEclipse,这是Eclipse的插件,一般是开发J2EE用的(注意版本的兼容性。推荐JDK 5 + Eclipse 3.2 + MyEclipse 5.0)。然后:File -> New -> Project -> MyEclipse -> J2EE Project -> Web Project,然后为你的项目起个名字(这步是创建一个WEB工程)。然后在Package Explorer窗口中打开你刚刚创建的项目,在Web Root中创建个JSP文件(单击Web Root -> 鼠标右键 -> New -> JSP),把你抄好的代码写上。然后点击工具栏上Window -> Proference -> MyEclipse -> Application Servers -> Tomcat 5 -> 选择你的Tomcat 安装路径,并选择Enable,然后OK(这步是配置Tomcat)。
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html