2014-02-26 167 views
1

當我運行我的jsp文件時出現此錯誤,請幫我找出此問題。從jva.util.Date頁面進口是JSP的org.apache.jasper.jasperexception無法爲jsp編譯類

HTTP Status 500 - Unable to compile class for JSP: 

type Exception report 

message Unable to compile class for JSP: 

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: 619 in the jsp file: /bbb_api.jsp 
The type Date is ambiguous 
616:    String starttime = recording.getElementsByTagName("startTime").item(0).getTextContent(); 
617:    try{ 
618:     SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); 
619:     Date resultdate = new Date(Long.parseLong(starttime)); 
620:     starttime = sdf.format(resultdate); 
621:    }catch(Exception e){ 
622: 

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:443) 
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:723) 

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

我已經導入了命名空間<%@ page import =「java.util。*」%> – Sathesh

回答

1

進口日期

<%@page import="java.util.Date" %> 

或使用

Date類的完全合格的名稱,如java.util.Date

java.util.Date resultdate = new java.util.Date(Long.parseLong(starttime)); 

SQL軟件包日期和實用程序之間的含糊不清日期類別

0

我想你導入了java.util.Date和javax.sql.Date。

嘗試從import語句中刪除javax.sql.Date。

相關問題