jsp问题求救
来源:百度知道 编辑:UC知道 时间:2024/06/29 21:01:34
我写了一个简单的代码:
<html>
<head>
<title>Demo Page</title>
</head>
<body>
<p align="center">
Now is:<br>
<%=java.util.Date()%>
</p>
</body>
</html>
运行时显示的错误是:
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: Unable to compile class for JSP
An error occurred at line: 8 in the jsp file: /hello.jsp
Generated servlet error:
java.util cannot be resolved to a type
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(Js
<html>
<head>
<title>Demo Page</title>
</head>
<body>
<p align="center">
Now is:<br>
<%=java.util.Date()%>
</p>
</body>
</html>
运行时显示的错误是:
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: Unable to compile class for JSP
An error occurred at line: 8 in the jsp file: /hello.jsp
Generated servlet error:
java.util cannot be resolved to a type
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(Js
<%=new java.util.Date()%>
你这段代码没有问题???
我改了两个地方,一个是把Date类引入,另一个是先实例化,再输出.
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.Date" %>
<html>
<head>
<title>Demo Page</title>
</head>
<body>
<p align="center">
Now is:<br>
<%
Date nowTime = new Date();
out.print(nowTime);
%>
</p>
</body>
</html>
<%=new java.util.Date()%>
你的类路径设置有问题.
JAVA运行环境没有设置好吧?
其它JAVA文件能正常运行吗?