匿名使用者
匿名使用者 發問時間: 電腦與網際網路程式設計 · 1 0 年前

jsp程式發生錯誤,請會的人教我怎麼改

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: 6 in the jsp file: /guestbook/guestbook.jsp

Generated servlet error:

[javac] Compiling 1 source file

C:\\Tomcat\\work\\Standalone\\localhost\\TEST\\guestbook\\guestbook_jsp.java:57: cannot resolve symbol

symbol : class Date

location: class org.apache.jsp.guestbook_jsp

Date today = new Date();

^

An error occurred at line: 6 in the jsp file: /guestbook/guestbook.jsp

Generated servlet error:

C:\\Tomcat\\work\\Standalone\\localhost\\TEST\\guestbook\\guestbook_jsp.java:57: cannot resolve symbol

symbol : class Date

location: class org.apache.jsp.guestbook_jsp

Date today = new Date();

^

An error occurred at line: 6 in the jsp file: /guestbook/guestbook.jsp

Generated servlet error:

C:\\Tomcat\\work\\Standalone\\localhost\\TEST\\guestbook\\guestbook_jsp.java:71: cannot resolve symbol

symbol : class File

location: class org.apache.jsp.guestbook_jsp

File file = new File(path);

^

An error occurred at line: 6 in the jsp file: /guestbook/guestbook.jsp

Generated servlet error:

C:\\Tomcat\\work\\Standalone\\localhost\\TEST\\guestbook\\guestbook_jsp.java:71: cannot resolve symbol

symbol : class File

location: class org.apache.jsp.guestbook_jsp

File file = new File(path);

^

An error occurred at line: 6 in the jsp file: /guestbook/guestbook.jsp

Generated servlet error:

C:\\Tomcat\\work\\Standalone\\localhost\\TEST\\guestbook\\guestbook_jsp.java:73: cannot resolve symbol

symbol : class FileWriter

location: class org.apache.jsp.guestbook_jsp

FileWriter output = new FileWriter(path, true);

^

只能貼上一部份,如果你可以幫我改,我可以寄全部給你。

4 個解答

評分
  • 1 0 年前
    最佳解答

    C:\Tomcat\work\Standalone\localhost\TEST\guestbook\guestbook_jsp.java:57: cannot resolve symbol

    symbol : class Date

    location: class org.apache.jsp.guestbook_jsp

    Date today = new Date();

    這個錯誤應該是沒有

    import java.util.*;

    ---------------------------------------------------------------------------------

    C:\Tomcat\work\Standalone\localhost\TEST\guestbook\guestbook_jsp.java:71: cannot resolve symbol

    symbol : class File

    location: class org.apache.jsp.guestbook_jsp

    File file = new File(path);

    ^

    加一行 import java.io.*

    ---------------------------------------------------------------------------------

    其它的都差不多,你該查查 java document 比較實在

    參考資料: java document,我,google
  • Samuel
    Lv 5
    1 0 年前

    你沒有import啦

    import java.util.Date;

    import java.io.File;

    Good luck

    參考資料: Java 2 Platform, Standard Edition, v 1.4.2 API Specification
  • 目前上面的錯誤是少了import java.util.Date, java.io.File, java.io.FileWriter

    只要再jsp檔案上多加<%@page import=" java.util.*, java.io.*"%>就可以了

    2006-04-03 18:36:00 補充:

    給上面的..

    Date today = new Date; // <--這行能跑隨便你....

    別誤導別人好不好="=

  • 1 0 年前

    只能跟你說您宣告變數有問題

    必須這樣寫:

    Date today = new Date;

    其他同理,

    FileWriter有這個型態嗎?

    你再查一下

還有問題?馬上發問,尋求解答。