回 帖 发 新 帖 刷新版面

主题:到底是什么错误,急啊!!快帮我,在线等

我装好了JDK而且测试成功,装好了TOMCAT5.0,而且http://localhost:8080/工作正常,可是当我按书上写一个JSP程序时出错了
错误信息如下:
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

Generated servlet error:
F:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\_1_jsp.java:6: cannot resolve symbol
symbol  : class date
location: package util
import java.util.date;
                 ^


An error occurred at line: 3 in the jsp file: /1.jsp
Generated servlet error:
F:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\_1_jsp.java:46: cannot resolve symbol
symbol  : class string
location: class org.apache.jsp._1_jsp
string date=dateformat.gerinstance().format(new date());
^


An error occurred at line: 3 in the jsp file: /1.jsp
Generated servlet error:
F:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\_1_jsp.java:46: cannot resolve symbol
symbol  : class date
location: class org.apache.jsp._1_jsp
string date=dateformat.gerinstance().format(new date());
                                                 ^


An error occurred at line: 3 in the jsp file: /1.jsp
Generated servlet error:
F:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\_1_jsp.java:46: cannot resolve symbol
symbol  : variable dateformat
location: class org.apache.jsp._1_jsp
string date=dateformat.gerinstance().format(new date());
             ^
4 errors



    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
    org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:437)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    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)



我的源程序是
<body bgcolor="white">
<%@ page import="java.util.date,java.text.*"%>
<% string date=dateformat.gerinstance().format(new date());%>
<p>the date and time are: <em><font color="#aa0000"><%= date%></em></font></body>

我的环境变量也按书上设置好了。。

怎么会这样,,

奇怪的是我写的查看文件路径的方法可以成功,

这是什么问题?

回复列表 (共1个回复)

沙发

请注意你的大小写,和单词拼写,正确的代码如下:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.util.Date,java.text.*"%>
<html>
<body bgcolor="#ffffff">
<% String date=DateFormat.getInstance().format(new Date());%>
<p>the date and time are: <em><font color="#aa0000"><%=date%></font></em></p>
</body>
</html>

我来回复

您尚未登录,请登录后再回复。点此登录或注册