新手请教下JSP问题 求高手指教
代码:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isErrorPage="true"%>
<html>
<head>
<title>111</title>
</head>
<body>
<%
out.println("现在时间"+new java.util.Date().toLocalString());
%></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: /jspdemo01/hello.world.jsp
The method toLocalString() is undefined for the type Date
5: </head>
6: <body>
7: <%
8: out.println("现在时间"+new java.util.Date().toLocalString());
9: %></body>
10: </html>
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.
------解决方案--------------------
An error occurred at line: 8 in the jsp file: /jspdemo01/hello.world.jsp
The method toLocalString() is undefined for the type Date
拼写错误,不是:
toLocalString()
而是:
toLocaleString()
顺便说下,这个函数已经Deprecated,不推荐使用。
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html