JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java 程式分享區 » Web  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 JSP WebMail 分享
andowson





發文: 77
積分: 3
於 2004-11-30 13:15 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Smile
大家好:之前寫了一個WebMail的程式,最近想加入過濾垃圾信的功能,想來自己也沒什麼時間,不如開放出來讓有興趣的人一起參與,如果有錯誤的地方或您有修改的話,請不吝回個信告訴我。
因為當初是依附在某個站台底下,所以下載檔案回去,解開後
請將images放到您的站台根目錄,才不會出現找不到圖的問題。
請至這裡下載最新版
http://www.andowson.com/posts/list/155.page

webmail-0.8.1.zip (386.34k)


andowson edited on 2012-08-02 12:31
reply to postreply to post
歡迎參加您買書,我付錢活動
作者 Re:JSP WebMail 分享 [Re:andowson]
stanely





發文: 4
積分: 0
於 2004-12-03 14:59 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
這麼有趣的東西,真是感謝.
一登入hinet的之後,介面真是棒啊.
看慣了hinet不負責任的webmail系統之後,只有覺得hinet真是偷懶.


reply to postreply to post

一步一步累積自己的實力及經驗,
希望台灣可以更強.....
作者 Re:JSP WebMail 分享 [Re:andowson]
reggie

Java Life



發文: 238
積分: 1
於 2004-12-03 23:32 user profilesend a private message to usersend email to reggiereply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
怪~~登入不了...出現「打不開信箱」
郵件主機、帳號、密碼都確認過了...@_@


reply to postreply to post
愈來愈喜歡吃蘋果了
作者 Re:JSP WebMail 分享 [Re:andowson]
andowson





發文: 77
積分: 3
於 2004-12-05 15:22 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
這個問題我也有遇到...重新登入一次就行了...
至於為什麼...我得再查查n另外有些中文信解碼的不是很好, 這個我也會再找時間改進一下


reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
pulse





發文: 8
積分: 0
於 2004-12-09 22:46 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
您好
我將它部署在我的tomcat後然後試著執行
有出現首頁
但是我輸入郵件主機 帳號 密碼後
卻出現以下錯誤訊息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
 
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:6: package javax.mail does not exist
import javax.mail.*;
^
 
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:7: package javax.mail.internet does not exist
import javax.mail.internet.*;
^
 
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:8: package com.psol.webpop3 does not exist
import com.psol.webpop3.InboxManager;
                        ^
 
An error occurred at line: 23 in the jsp file: /login.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:14: cannot resolve symbol
symbol  : class InboxManager 
location: class org.apache.jsp.login_jsp
    InboxManager inboxManager = null;
    ^
 
An error occurred at line: 23 in the jsp file: /login.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:15: cannot resolve symbol
symbol  : class Folder 
location: class org.apache.jsp.login_jsp
    Folder inbox = null;
    ^
 
An error occurred at line: 27 in the jsp file: /login.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:73: cannot resolve symbol
symbol  : class URLName 
location: class org.apache.jsp.login_jsp
        URLName url = new URLName("pop3", host, 110, "", user, password);         
        ^
 
An error occurred at line: 27 in the jsp file: /login.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:73: cannot resolve symbol
symbol  : class URLName 
location: class org.apache.jsp.login_jsp
        URLName url = new URLName("pop3", host, 110, "", user, password);         
                          ^
 
An error occurred at line: 27 in the jsp file: /login.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:75: cannot resolve symbol
symbol  : class InboxManager 
location: class org.apache.jsp.login_jsp
            inboxManager = new InboxManager(url);
                               ^
 
An error occurred at line: 27 in the jsp file: /login.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:79: cannot resolve symbol
symbol  : class AuthenticationFailedException 
location: class org.apache.jsp.login_jsp
        } catch (AuthenticationFailedException e) {
                 ^
 
An error occurred at line: 27 in the jsp file: /login.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jspwebmail\org\apache\jsp\login_jsp.java:88: cannot resolve symbol
symbol  : class InboxManager 
location: class org.apache.jsp.login_jsp
        inboxManager = (InboxManager) session.getAttribute("inboxmanager");
                        ^
10 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:412)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
  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)
 
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
 
--------------------------------------------------------------------------------
 
Apache Tomcat/5.0.28
 


小弟查不出是哪裡出問題了
請前輩知道的話提示一下小弟
感恩
============
執行環境
tomcat5.0
jdk1.41
ie6.0
郵件主機 智邦msxx.url.com.tw


reply to postreply to post
java......等等我啊.....
作者 Re:JSP WebMail 分享 [Re:pulse]
andowson





發文: 77
積分: 3
於 2004-12-09 23:08 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
可能是我沒說明清楚,我再仔細說明一下,安裝的方法
假設CATALINA_HOME是你安裝Tomcat 5.x的目錄
將jspwebmail.zip解開後,會看到三個目錄
images
webamil
WEB-INF
請將images複製到$CATALINA_HOME/webapps/ROOT底下
將webmail複製到$CATALINA_HOME/webapps下
將WEB-INF複製到$CATALINA_HOME/webapps/webmail下
應該就可以跑了
存取的路徑是http://localhost:8080/webmail/index.html


reply to postreply to post
歡迎參加您買書,我付錢活動
作者 Re:JSP WebMail 分享 [Re:andowson]
andowson





發文: 77
積分: 3
於 2004-12-09 23:27 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
補充說明:
因為我試著將它改成獨立的webapp,這是當初沒考慮到的,所以可能有些路徑要自己改一下
例如,如果要將images搬到webmail目錄下,則您要將所有程式碼中的/images/webmail改成images/webmail,/images/html_editor改成images/html_editor。
另外showmail.jsp裡面的這一行
1
2
3
4
<form name="delmail" method="post"
      action="http://<%=request.getServerName()+
           request.getServletPath().replaceAll("show", "delete")%>"
      target="_self">

需改成
1
2
3
4
<form name="delmail" method="post"
      action="http://<%=request.getServerName()+request.getContextPath()+
           request.getServletPath().replaceAll("show", "delete")%>"
      target="_self">

整個程式的核心是WebMailUtil.java
有興趣可以自己去改裡面的解中文碼程式(例如將精靈所寫的那個MailUtil.java整合進來,我試過,還滿容易的)


reply to postreply to post
歡迎參加您買書,我付錢活動
作者 Re:JSP WebMail 分享 [Re:pulse]
frank



版主

發文: 498
積分: 13
於 2004-12-09 23:30 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你的 CLASSPATH 還缺少 mail.jar和activation.jar
http://www.javaworld.com.tw/jute/post/view?bid=7&id=48687&tpg=1&ppg=1&sty=3&age=0#48687
http://www.javaworld.com.tw/jute/post/view?bid=6&id=44401&tpg=1&ppg=1&sty=1&age=0#44401


reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
tai1110





發文: 157
積分: 0
於 2004-12-22 22:02 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請問一下 ^^"
在下載附件的時候 … 他的檔名怎麼都會跟 網頁名稱 一樣 showattach ???
TKS


reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
andowson





發文: 77
積分: 3
於 2004-12-23 02:03 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請更改WebMailUtil.java裡面的writePart() method
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  public static void writePart(Message msg,
                          HttpServletRequest request,
                          HttpServletResponse response)
      throws IOException, MessagingException
  {
      int partnr = Integer.parseInt(request.getParameter("part"));
      Part p;
      if (partnr < 0)
          p = msg;
      else {
          Multipart mp = (Multipart)msg.getContent();
          p = mp.getBodyPart(partnr);
      }
      response.setContentType(p.getContentType());      
      String filename = p.getFileName();
      if (filename != null) {
          //filename = procSubject(filename);
          if (isEncoded(filename)) {
            if (isQPEncoded(filename)) {
              filename = decodeQ(filename);
            } else {
              filename = MimeUtility.decodeText(filename);
            }
          }
          else {
            filename = toBig5String(filename);
          }                            
          //http://www.javaworld.com.tw/jute/post/view?bid=6&id=16669&sty=1&tpg=1&age=0
          //[分享] 強制存檔的方法 [精華]     
          response.setHeader("Content-Disposition",
                             "attachment; filename=\"" +
                             java.net.URLEncoder.encode(filename, "utf-8") + "\"");
      }
      try {
          OutputStream out = response.getOutputStream();
          InputStream in = p.getInputStream();
          int c = in.read();
          while (c != -1) {
              out.write(c);
              c = in.read();
          }
          in.close();
          out.close();  // remember to close the OutputStream
      } catch (IllegalStateException e) {
          System.out.println(e.getMessage());
      }
  }



andowson edited on 2004-12-23 02:17
reply to postreply to post
歡迎參加您買書,我付錢活動
作者 Re:JSP WebMail 分享 [Re:andowson]
andowson





發文: 77
積分: 3
於 2004-12-24 01:26 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
這∼我就不是很清楚了,不過我可以分享一下我的執行環境供您參考:
Server:
OS: RedHat Linux 9
JDK: SUN J2SE 5.0
Web: Apache2 + Tomcat 5.5.4 + mod_jk2
Client:
OS: Windows XP
Browser: IE 6.0 SP1
Office: Office 2003
這樣測起來是OK的,你可能需要看一下辦公室跟家裡的環境是差在哪裡,才能找出問題的原因。


reply to postreply to post
歡迎參加您買書,我付錢活動
作者 Re:JSP WebMail 分享 [Re:andowson]
hsinichi





發文: 10
積分: 0
於 2004-12-24 12:04 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請問1下,有轉寄的功能嗎?

另外我也想補充一下,
我在點選寄出信件或回覆信件時寄出後
會出現 無此目錄情況.
如下:
1
org.apache.jasper.JasperException: Not a directory: C:\Tomcat\webapps\webmail\temp\C10289DBBC9672F507B1813F61CCAB35


後來我在editmail.jsp中
加入如下:
1
Runtime.getRuntime().exec("cmd /c mkdir "+ request.getRealPath("/")+"temp"+File.separator+session.getId() );


sendmail.jsp 加入
1
Runtime.getRuntime().exec("cmd /c rmdir /s /q "+ request.getRealPath("/")+"temp"+File.separator+session.getId() );


就可以了...
我的環境是
OS:windows 2000
JDK: SUN J2SE 5.0
Web: Tomcat 4.1.31


hsinichi edited on 2004-12-24 12:35
reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
hsinichi





發文: 10
積分: 0
於 2004-12-24 12:29 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在 OS:RedHat Linux 9 上
於editmail.jsp中加入如下:
1
Runtime.getRuntime().exec("mkdir "+ request.getRealPath("/")+"temp"+File.separator+session.getId() );


sendmail.jsp加入:
1
Runtime.getRuntime().exec("rm -rf "+ request.getRealPath("/")+"temp"+File.separator+session.getId() );


hsinichi edited on 2004-12-24 12:33
reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
andowson





發文: 77
積分: 3
於 2004-12-24 12:33 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
轉寄的功能目前是沒有,不過應該可以作得出來,只是需要再一下想畫面怎麼擺,及一些操作,例如拿掉其中一個原來的檔案,換上一個新的,這邊的一些邏輯還得想想。

有關寄信的這個問題我也作了修正,不過沒放上來,會出現這個錯誤的原因是後來我把related式的mail中cid後面的圖給存到temp資料夾下了,等使用者登出時就自動清除掉。這個temp資料夾在安裝時,得自己create啦...
我是修改sendmail.jsp裡面的開頭
1
2
3
4
5
6
7
8
<%
    // 宣告將上傳之檔案放置到伺服器的temp目錄中
    String saveDirectory = request.getRealPath("/")+"temp"+File.separator+session.getId();
    webmail.createDirs(saveDirectory, true);
 
    // 宣告限制上傳之檔案大小為 5 MB
    int maxPostSize = 5 * 1024 * 1024 ;
---

WebMailUtil.java中
1
2
3
4
5
6
7
8
9
10
11
12
  /**
   * 建立完整目錄
   */
  public static void createDirs(String dir, boolean ignoreIfExitst)
      throws IOException {
    File file = new File(dir);
    if (ignoreIfExitst && file.exists()) return;
    if (!file.mkdirs()) {
      throw new IOException("Cannot create directories = " + dir);
    }
    file.deleteOnExit();
  }


andowson edited on 2004-12-24 12:44
reply to postreply to post
歡迎參加您買書,我付錢活動
作者 Re:JSP WebMail 分享 [Re:andowson]
hsinichi





發文: 10
積分: 0
於 2004-12-24 13:07 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
andowson wrote:
轉寄的功能目前是沒有,不過應該可以作得出來,只是需要再一下想畫面怎麼擺,及一些操作,例如拿掉其中一個原來的檔案,換上一個新的,這邊的一些邏輯還得想想。


謝主隆恩

我想轉寄的部份應該在於附件轉寄處理較複雜些...
是不是一定要在 Server 端H.D.D上先建立好檔案才能將附件寄出呢?


hsinichi edited on 2004-12-24 13:28
reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
andowson





發文: 77
積分: 3
於 2004-12-25 12:02 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
最簡單的情況,就是把原來的內容全部轉出去,可以先參考這一篇文章所寫的方式
http://java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailForwarding
比較複雜的情況還得請大家在多提供想法


reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
liuyw1982





發文: 1
積分: 0
於 2004-12-27 19:24 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
为什么我会有以下的错误的?

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:
H:\Tomcat5\work\Catalina\localhost\webmail\org\apache\jsp\login_jsp.java:8: cannot access com.andowson.InboxManager

Generated servlet error:
bad class file: H:\Tomcat5\webapps\webmail\WEB-INF\classes\com\andowson\InboxManager.class
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
import com.andowson.InboxManager;
^
1 error

  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:412)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
  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)


reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
andowson





發文: 77
積分: 3
於 2004-12-28 00:57 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
這邊應該就是關鍵了∼(希望您可以培養自己找出問題及原因的能力)
1
2
bad class file: H:\Tomcat5\webapps\webmail\WEB-INF\classes\com\andowson\InboxManager.class
class file has wrong version 49.0, should be 48.0

請使用SUN J2SE 5.0的環境或重新編譯一次InboxManager.java吧(如果您是使用非J2Se 5.0的環境)


reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:hsinichi]
andowson





發文: 77
積分: 3
於 2005-01-02 21:40 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
hsinichi wrote:
我想轉寄的部份應該在於附件轉寄處理較複雜些...
是不是一定要在 Server 端H.D.D上先建立好檔案才能將附件寄出呢?

我同意您的看法,有關轉寄的處理,我想可以依照下列步驟
1.在WebMailUtil.java裡的processAttachment()內將附檔全部存到暫存目錄,並將檔名存成一個ArrayList,如attachmentList,同時新增一個getAttachmentList() method以便取得attachmentList。
2.在editmail.jsp裡判斷傳入的action參數,如果action=forward的話,利用getAttachment()取得attachmentList,並將attachmentList設到session去,同時顯示在畫面上(這邊可能就得想如何顯示比較容易作移除附件了,例如設一個隱藏欄位叫做removedAttachmentList,用逗號隔開每個檔名)。
3.按下傳送時sendmail.jsp讀取session中的attachmentList,然後讀取removedAttachmentList,將被移除的檔案從attachmentList移除,剩下來的再與新增的附件一起處理即可。利用原先程式內的Vector v的v.add()即可。


reply to postreply to post
歡迎參加您買書,我付錢活動
作者 Re:JSP WebMail 分享 [Re:andowson]
andowson





發文: 77
積分: 3
於 2005-01-06 02:29 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
今天回家發現家裡的電腦電源供應器因晚上停電壞了,還好我有備份在筆記型電腦上的版本,我把最新的版本放上來,希望大家有空再加以改良。

這個版本裡面我包含了一個build.xml,如果您需要重新編譯原始碼的話,請到WEB-INF/src目錄下執行ant jar(請先安裝ant),這樣應該會產生好webmail.jar,放在WEB-INF/lib下

這個版本是我在Windows XP上用JDK 1.5.0編譯而成。

webmail-0.7.0.zip (912.38k)


andowson edited on 2005-01-06 02:34
reply to postreply to post
歡迎參加您買書,我付錢活動
作者 Re:JSP WebMail 分享 [Re:andowson]
cseserv





發文: 29
積分: 0
於 2005-02-02 13:10 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
andowson wrote:
今天回家發現家裡的電腦電源供應器因晚上停電壞了,還好我有備份在筆記型電腦上的版本,我把最新的版本放上來,希望大家有空再加以改良。

這個版本裡面我包含了一個build.xml,如果您需要重新編譯原始碼的話,請到WEB-INF/src目錄下執行ant jar(請先安裝ant),這樣應該會產生好webmail.jar,放在WEB-INF/lib下

這個版本是我在Windows XP上用JDK 1.5.0編譯而成。


首先謝謝andowson

小弟試用後發現一個問題

如果郵件本身的header被更改過

而沒有包含disposition的content
那麼
attachment將不會被寫出
所以附件的部分也會有問題
-->也就是沒有類似
http://localhost:8080/webmail/showattach.jsp?msg=3&part=1
的連結產生

追查一下
會發現到cid跟disp都為null

看一下檔頭

一般是
Content-Type: text/plain;
  name="GHOST9.txt"
Content-Transfer-Encoding: base64
Content-Description: GHOST9.txt
Content-Disposition: attachment;

遇到不能處理的類型是

Content-Type: application/octet-stream; name="Aimm_Lab=?ISO-8859-1?Q?=B3q=B0T=BF=FD=2891=A6~=AA=A9?=).doc"
Content-Transfer-Encoding: base64

小弟這時候以disp==null的判斷條件
湊出上述的filename 就name=的內容
然後仿造
disp != null && disp.equalsIgnoreCase(Part.ATTACHMENT)該片段副程式

就可以加入attachment

小經驗

希望對有經驗的人有參考價值


cseserv edited on 2005-02-02 14:37
reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
hbtsai





發文: 7
積分: 0
於 2005-02-18 17:45 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
大家好, 我出現以下的訊息 com.andowson.InboxManager
這支class有版本問題???


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: -1 in the jsp file: null

Generated servlet error:
[javac] Compiling 1 source file

C:\tomcat5019\work\Catalina\jwm\_\org\apache\jsp\login_jsp.java:8: cannot access com.andowson.InboxManager
bad class file: D:\www\jwm\WEB-INF\classes\com\andowson\InboxManager.class
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
import com.andowson.InboxManager;
^
1 error

  org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
  org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
  org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
  org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

note The full stack trace of the root cause is available in the Tomcat logs.


reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:andowson]
andowson





發文: 77
積分: 3
於 2005-02-19 11:29 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
您使用的應該是JDK1.4.x吧?
我在程式裡面用到了JDK 5.0的feature.
所以如果你要在JDK1.4.x上執行
請將ArrayList<String>全部取代回ArrayList
再重新編譯即可


reply to postreply to post
作者 Re:JSP WebMail 分享 [Re:hsinichi]
c841





發文: 3
積分: 0
於 2005-03-06 17:44 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
哈哈,太棒了!

只是问题在反回前一页时出现问题(说不能打开)

本人也在开发javamail系统,看到你的我收益好大。

下次我把我做的发一个给你。


reply to postreply to post
作者 Re:JSP WebMail 分享 to:andowson [Re:andowson]
c841





發文: 3
積分: 0
於 2005-03-10 12:15 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
看了你的代码确实很好,不过还是有很多小问题,比如下面的我在关闭Tomcat后就经常出现下面的错误,显然是temp目录里的文件
信息: Cannot serialize session attribute inboxmanager for session 095C5F2D1C3DF3E16F365F14AD2A95A0
java.io.NotSerializableException: com.sun.mail.imap.IMAPFolder
  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
  at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1412)
  at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:899)
  at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:539)
  at org.apache.catalina.session.StandardManager.unload(StandardManager.java:485)
  at org.apache.catalina.session.StandardManager.stop(StandardManager.java:687)
  at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4496)
  at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:952)
  at org.apache.catalina.core.StandardHostDeployer.remove(StandardHostDeployer.java:670)
  at org.apache.catalina.core.StandardHost.remove(StandardHost.java:946)
  at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1013)
  at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:990)
  at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:351)
  at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
  at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1123)
  at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1135)
  at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:483)
  at org.apache.catalina.core.StandardService.stop(StandardService.java:542)
  at org.apache.catalina.core.StandardServer.stop(StandardServer.java:2347)
  at org.apache.catalina.startup.Catalina.stop(Catalina.java:605)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:580)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:324)
  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)

2、在读取邮件列表时速度还是很慢,我怀疑是否多次读取了。
3、我建议在显示邮件列表时读取XML文件,即只有新邮件到时或删除,才刷新XML文件,这样即可快速度显示,又可达到更多的功能(如排序),这是国外的普遍的。


reply to postreply to post
go to first page go to previous page  1   2   3   4  go to next page go to last page
» JWorld@TW »  Java 程式分享區 » Web

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8