天山涼快

          java分壇

          2006年7月8日

          免費送你漂亮的E-Mail圖標


          E-Mail Icon Generator

          想得到漂亮E-mail的圖標嗎?

          到這個網站: http://services.nexodyne.com/email/index.php

          這個位置

          選中你自己的郵箱和用戶名,然后點下面的 Generate 按鈕就可以了


          這個是我的一個Gmail的郵箱,現在注冊Gmail需要邀請函,如果有人需要

          可以發一個郵件給我,我會回一封邀請函給你。

          下面這個是qq的郵箱:

          posted @ 2006-07-08 10:31 Ynmc 閱讀(649) | 評論 (0)編輯 收藏

          2006年6月27日

          Java 經驗累積(隨時更新).

          把平常收集到的和遇到的一些小問題列出來,以備不時之需.
          也歡迎大家把自己的收藏跟貼.

          1. 將String轉換成InputStream

          import java.io.ByteArrayInputStream;
          import java.io.InputStream;
          String ? str ? = ? "";//add ? your ? string ? content
          InputStream ? inputStream ? = ? new ? ByteArrayInputStream(str.getBytes());

          2. String和數字互相轉換

          1 如何將字串 String 轉換成整數 int?

          ? 有兩個方法:

          ? 1). int i = Integer.parseInt([String]); 或

          ????? i = Integer.parseInt([String],[int radix]);

          ? 2). int i = Integer.valueOf(my_str).intValue();

          ? 注: 字串轉成 Double, Float, Long 的方法大同小異.

          2 如何將整數 int 轉換成字串 String ?

          ? 1.) String s = String.valueOf(i);

          ? 2.) String s = Integer.toString(i);

          ? 3.) String s = "" + i;

          ? 注: Double, Float, Long 轉成字串的方法大同小異.

          posted @ 2006-06-27 17:05 Ynmc 閱讀(747) | 評論 (1)編輯 收藏

          2006年6月26日

          DWR 用xom,dom4j傳輸Document或者Element數據的小問題。

          作者: ynmc
          原文地址:http://www.aygfsteel.com/ynmc/archive/2006/06/26/55149.html歡迎轉載,請保留出處.

          在用DWR傳輸xml文檔(document)或者節點(Element)的時候,通過DWR Debug頁面從函數中直接取返回數據時,由于DWR對于Firefox的支持度比IE好的原因,在FireFox下面能正常運行,在IE下會報[Ojbect Error]。我用DWR1.1和DWR M2兩個版本都進行了測試,都會報出同樣的錯誤。

          關于這個錯誤,我已經和DWR的作者joe walker通過user-list聯系過,他表示由于時間的問題,在ie下面的確有一些bug沒有來得及處理。

          同時,我又做了一些測試,發現其實這個問題確實如Joe后來回復的郵件所說,是個沒有什么意義的小問題。在IE下其實也是可以傳遞Document或者Element數據的,只是在DWR Debug頁面下,直接從函數中返回Document或者Element時,DWR彈出的顯示元素的對話框。這個時候DWR隱式的將Document或者Element對象轉換成了String,而DWR對FireFox支持的較好,沒有問題,而在IE中就會彈出Object Error錯誤。

          所以對實際應用來講,這個bug完全可以忽略,因為除了debug以外,在使用中沒有任何影響。

          Joe 最后回復了郵件,也給出了處理辦法,他的意思是這種情況出現的比較少,意義不大(我就是聽他說了這句話之后發現了開始自己的理解有誤,看來多與人交流是非常重要的啊。)

          下面是郵件原文:

          From: Joe Walker <joseph.walker@...>
          Subject: Re: Re: [new user]problem: can't send/return DOM object?
          Newsgroups: gmane.comp.java.dwr.user
          Date: 2006-06-26 08:32:37 GMT (1 day and 48 minutes ago)
          Expires: This article expires on 2006-07-10


          The DOM converter will convert from browser DOM objects to server side DOM objects, but it wasn't designed to convert from browser strings to SS DOM.

          How do you parse a browser string into a browser DOM?

          This can't be done without some cross-browser tweaks. Take a look at DWREngine._unserializeDocument(). It is a private method to DWREngine, so you should not use it directly, but you can copy it.

          DWREngine._unserializeDocument = function(xml) {
          ? var dom;
          ? if (window.DOMParser) {
          ??? var parser = new DOMParser();
          ??? dom = parser.parseFromString(xml, "text/xml");
          ??? if (!dom.documentElement || dom.documentElement.tagName == "parsererror") {
          ????? var message = dom.documentElement.firstChild.data;
          ????? message += "\n" + dom.documentElement.firstChild.nextSibling.firstChild.data;
          ????? throw message;
          ??? }
          ??? return dom;
          ? }
          ? else if ( window.ActiveXObject) {
          ??? dom = DWREngine._newActiveXObject(DWREngine._DOMDocument);
          ??? dom.loadXML(xml);
          ??? // What happens on parse fail with IE?
          ??? return dom;
          ? }
          ? else {
          ??? var div = document.createElement ('div');
          ??? div.innerHTML = xml;
          ??? return div;
          ? }
          };

          There is bug in IE is that I mentioned in a previous post. The bug is that HTML nodes do not have the DOM properties to allow DWR to marshall them properly. This might be something that DWR can work around, but to date I have never seen the need to fix the bug. Sending the browser HTML DOM to the server isn't all that useful since the server gave it to the browser in the first place.

          Joe.


          目前的ajax框架中DWR的文檔是做的比較好的,這也有利于廣大的開發者。
          DWR 官方站點:
          http://getahead.ltd.uk/dwr/

          DWR User-list(作者會經常對在這里提出的問題進行回答,目前已經有約5000條記錄):
          http://news.gmane.org/gmane.comp.java.dwr.user

          最后感謝Joe Walker,他不僅寫出了DWR,還非常熱心的回答了我和其它user的問題。

          posted @ 2006-06-26 14:27 Ynmc 閱讀(2325) | 評論 (3)編輯 收藏

          有團員搞Ajax的嗎?

          最近一直在做Web,用到ajax框架DWR,很少有地方專門討論這個東東的,希望大家能一起交流交流。

          posted @ 2006-06-26 12:04 Ynmc 閱讀(178) | 評論 (0)編輯 收藏

          加入了Jlive團隊。

          這是本人第一次加入團隊,希望能好好學習,天天向上。

          posted @ 2006-06-26 11:27 Ynmc 閱讀(252) | 評論 (0)編輯 收藏

          新開Java blog

          新開java的blog,并加入Jlive團隊。

          posted @ 2006-06-26 11:11 Ynmc 閱讀(189) | 評論 (0)編輯 收藏

          僅列出標題  
          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          導航

          統計

          常用鏈接

          留言簿(1)

          我參與的團隊

          隨筆分類

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 合水县| 阿坝| 永善县| 蓬莱市| 托里县| 洛浦县| 延寿县| 永城市| 山东| 鄂托克前旗| 玛纳斯县| 明光市| 大同县| 英吉沙县| 马公市| 龙川县| 张家港市| 大关县| 达拉特旗| 石林| 黑河市| 大竹县| 台北市| 凤城市| 沙洋县| 墨竹工卡县| 虹口区| 鹿邑县| 获嘉县| 宿松县| 宁阳县| 潮州市| 建水县| 大姚县| 会泽县| 内江市| 溧阳市| 西青区| 富顺县| 祁东县| 伊春市|