云自無心水自閑

          天平山上白云泉,云自無心水自閑。何必奔沖山下去,更添波浪向人間!
          posts - 288, comments - 524, trackbacks - 0, articles - 6
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

           

          Struts2的官方文檔看似琳瑯滿目,但實際上并不完備,許多細節問題并沒有深入涉及,部分內容甚至還有錯誤(可參見:http://www.aygfsteel.com/usherlight/archive/2008/12/30/249143.html)。這次主要是補充一下,使用了ZeroConfig插件情況下,如何返回Stream類型的配置。
          在ZeroConfig+CodeBehind結合使用的情況下,Struts.xml中基本上已經空無一物了。配置基本上使用Annotation在Java的類中注釋完成。

          @Parent("default")
          @Result(name="rawFile", value="inputStream", type=StreamResult.class, params={"contentType", "text/html", "inputName", "inputStream", "", "", "bufferSize", "1024"})
          public class FileDownloadAction {
                  public String execute() throws Exception {
                          inputStream = new FileInputStream("c:\\temp\\file.txt");               
                  }
                  private InputStream inputStream;

                  //... getter and setter
          }
          這里最重要的是Result里面params的寫法,params后面的大括號中,奇數個字符串是key值,偶數個字符串是value值。
          其中,inputName的值-inputStream要和Class中的InputStream的屬性名一致,而Result中的value的值也要與之一致。

          posted @ 2009-01-06 17:30 云自無心水自閑 閱讀(2157) | 評論 (0)編輯 收藏

          今天試了一下引用url作為<s:a>的href,結果頁面根本不能正確顯示,后臺log里面出現了一大片的錯誤,大意是<s:param>的用法錯誤。但是我的寫法是完全copy在線文檔http://struts.apache.org/2.x/docs/a.html
          具體內容就是下面這一部分:
          <s:url id="testUrlId" namespace="/subscriber" action="customField" method="delete">
          <s:param name="customFieldDefinition.id" value="${id}"/>
          </s:url>
          經過嘗試發現實際上應該這樣寫: <s:param name="customFieldDefinition.id" value="id"/>
          struts2的文檔一直被大家所指責,看來這種指責不無道理啊

          posted @ 2008-12-30 13:17 云自無心水自閑 閱讀(1499) | 評論 (3)編輯 收藏

          我使用的是annotation方式的hibernate配置。結果在啟動Tomcat的時候報錯:
          Invocation of init method failed; nested exception is org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
          解決方法:
          去除Annotation中的所有FetchType="EAGAR"

          posted @ 2008-12-30 13:03 云自無心水自閑 閱讀(2701) | 評論 (2)編輯 收藏


          NetBeans從功能來上,是相當不錯的。而Eclipse則有一些成也插件,敗也插件的感覺,至少存在插件的版本依賴造成混亂的抱怨。
          但是NetBeans的在使用上的體驗與eclipse相比還是有較大的差距(個人感覺).
          首先令我感到不爽的是,netbeans不能正常停止tomcat.需要我手動在任務管理器里終止進程.
          其次,netbeans的部署好像有些問題,部署速度比較慢,deploying的進度條總在那里閃,需要較長的時間才部署完畢。而且重新部署的策略也讓人疑惑,感覺不是有了更新才部署,而是定時部署,因為我過了一段時間我就發現deploying的進度條出現了。最讓人不爽的是部署有問題。我更新了 applicationContext-security.xml,點擊clean and build,結果系統運行不正確,我查了半天才發現build目錄下的這個文件根本沒有改變。
          在視圖的查看上,netbeans也沒有eclipse方便靈活,在eclipse中我喜歡將源文件(package presentation)設置為hierarchical, 這樣在package explorer里面,視圖顯得比較簡潔。另外,eclipse可以設置代碼窗口與文件窗口里的文件連動。這兩個功能我在netbeans里還沒有找到。

          posted @ 2008-12-18 08:10 云自無心水自閑 閱讀(2384) | 評論 (11)編輯 收藏

          mysql安裝調試完畢,正式投入運行后,馬上進行了mysql備份任務的生成。結果第二天一看,并沒有能夠如愿地生成備份文件。
          馬上開始查找原因。首先在mysql administrator里立即運行備份任務,沒有問題,備份文件很快就生成了。但備份任務就是不能正確執行。
          在事件查看器里發現了mysql的錯誤日志,root@localhost(password: no)access denied, error number: 1045。
          奇怪,root@localhost無法登錄數據庫?可是登錄mysql administrator,并且在里面單獨運行backup都是正常的啊。
          冷靜一下,在windows控制面板的計劃任務里,找到數據庫備份的計劃任務(Mysql5.X的備份計劃實際上是生成了一個windows的計劃任務,執行其設置好的腳本),查看了一下腳本,并沒有什么問題。
          再仔細研究了一下,發現問題應該是在password:no上,相當于試圖不提供密碼而使用root@localhost進行備份,所以出錯了。那么如何改正呢。
          最后發現問題是在;mysql_user_connection.xml里。這個文件里包含了mysql登錄用的別名信息。結果不知道是什么原因這個文件里相同的別名出現了兩次,第一次的配置里密碼為空,而第二次的配置是正確的。

            <last_connection>2</last_connection>
            <password_storage_type>3</password_storage_type>
            <user_connection>
              <connection_name></connection_name>
              <username>root</username>
              <hostname>localhost</hostname>
              <port>3306</port>
              <schema></schema>
              <advanced_options/>
              <storage_path></storage_path>
              <notes></notes>
              <connection_type>0</connection_type>
              <storage_type>2</storage_type>
              <password_storage_type>3</password_storage_type>
              <password/>
            </user_connection>
            <user_connection>
              <connection_name>proddb</connection_name>
              <username>root</username>
              <hostname>localhost</hostname>
              <port>3306</port>
              <schema>message</schema>
              <advanced_options/>
              <storage_path></storage_path>
              <notes></notes>
              <connection_type>0</connection_type>
              <storage_type>2</storage_type>
              <password_storage_type>3</password_storage_type>
              <password/>
            </user_connection>
            <user_connection>
              <connection_name>proddb</connection_name>
              <username>root</username>
              <hostname>localhost</hostname>
              <port>3306</port>
              <schema>message</schema>
              <advanced_options/>
              <storage_path></storage_path>
              <notes></notes>
              <connection_type>0</connection_type>
              <storage_type>1</storage_type>
              <password_storage_type>3</password_storage_type>
              <password>9D203859E</password>
            </user_connection>


          而登錄mysql administrator時,根據last_connection的值,使用的是proddb的第二個配置。所以可以正常登錄,而且在里面執行腳本,備 份都沒有問題,而windows執行計劃任務時,通過別名proddb在mysql_user_connection.xml中查找,找到的是第一個,其 中沒有密碼信息,所以報錯。
          問題找到了,解決就容易了,刪除mysql_user_connection.xml中的proddb的第一個配置。備份計劃任務果然能夠正確地執行了。

          posted @ 2008-12-17 08:04 云自無心水自閑 閱讀(2065) | 評論 (0)編輯 收藏

          今天嘗試使用了一下兩款MSN的插件應用:Msn Shell和Msn Plus! Live。兩者都能解決多賬號登錄的要求。
          其中Msn Shell是國人產品而Msn Plus! Live是法國人開發的產品,但是其I18N做的還是不錯,內置了許多語言。
          我首先嘗試了Msn Plus! Live,第一感還是不錯的,安裝過程很順利。安裝好了之后,馬上就是相關的設置。
          設置完畢后,就可以直接使用了。其中我比較感興趣的是快捷文字輸入。
          但是我馬上發現一個問題:不知道為什么Msn Plus! Live總是占用15%左右的CPU,這一點令我十分不爽。直接從電腦從喀嚓出去。
          接下來安裝Msn Shell。安裝過程也是一樣的順利,功能明顯比Msn Plus! Live要多一點。在聯系人上面多了一條“最近聯系人”。
          還多了一個“天氣預報”可以自由選擇國內的城市。另外還可以設置屏蔽MSN里面的廣告。
          但也有一點不爽的是在下面多了一條MSN Shell的工具條,我并不需要,但無法取消。
          最后結論當然是選擇Msn Shell。

          posted @ 2008-12-12 17:49 云自無心水自閑 閱讀(1436) | 評論 (3)編輯 收藏

          right click project -> property -> source -> source/binary format -> choose JDK 5 instead of JDK 1.4

          最好的辦法是在新建項目時,在下拉框選擇J2EE 1.4后,不要根據NetBeans提示的勾選set source same as JDK,這樣會自動將Source設置為JDK 5而不是JDK 1.4.

          posted @ 2008-12-11 19:29 云自無心水自閑 閱讀(481) | 評論 (0)編輯 收藏

          01. download SpringSide 3.0.4 and extract to a folder and extract to a folder-SpringSide304
          02. cd SpringSide304, mvn compile
          03. mvn clean install
          04. cd examples\mini-web\bin
          05. start nexus, \tools\nexus\nexus-webapp-1.1.0\bin\jsw\windows-x86-32\Nexus.bat
          06. run copy-jar.bat, all the jar files will be generated in exmples\mini-web\webapp
          07. slf4j: jul-to-slf4j-1.5.6.jar
          08. dozer in sourceforge.net
          09. copy all the java source code in directory: modules\core\src\main\java\
          10. copy all the java source code in directory: examples\mini-web\src\main\java
          11. copy all the resource file in directory:examples\mini-web\src\main\resources
          12. copy all the file in examples\mini-web\webapp
          13. create database and run script in directory: examples\mini-web\src\main\sql\derby, if the database you use isn't derby, should modify the script
          14. modify the the datasource in ApplicationContext.xml, the database name, user name, user password
          15. copy the database jdbc driver package(for example: mysql-connector-java-X.jar) to lib
          16. mini-web.log is in tomcat\logs
          17. click run button in Netbeans.

          posted @ 2008-12-11 09:09 云自無心水自閑 閱讀(500) | 評論 (0)編輯 收藏

          UltraEdit是一個功能非常強大的文本編輯工具。
          但是,它不是免費的。
          在網上搜索了陣,對比了不少工具,諸如EMacs、Crimson Editor等等。最后選定了PSPad

          主要是因為:
          1、界面操作與UltraEdit比較類似,其他很多工具與日常的相差比較大。
          2、功能與UltraEdit相比,并沒有什么差別,我目前發覺得比較大的差別就在于列模式的選擇上。
          3、最大的優點就是免費。

          posted @ 2008-12-07 17:07 云自無心水自閑 閱讀(2821) | 評論 (1)編輯 收藏

          在網上搜索對比了一番,最后覺得還是EssentialPIM這個軟件最適合我的需要。
          我主要就是想找一個能夠每天記錄一下當天的工作日志,最好能有提醒功能(Schedule)
          EssentialPIM完全能夠勝任這個工作。
          其主要功能有:
          Schedule
          To-do List
          Notes
          界面簡單清晰。另外還有一個密碼保護的功能。
          非常適合我。
          推薦一把。
          地址:www.essentialpim.com

           1.Tools to satisfy your calendar, contact management, to do list and notes needs.
           2.Synchronization with Outlook, Windows Mobile devices, Palm, iPOD, Google Calendar.
           3.Simple printout of any or all modules and quick export of your data into the most useful formats (iCal, vCard, HTML).
           4.Strong data protection using Advanced Encryption Standard (AES) algorithm.
           5.Intuitive interface in many languages including German, Italian, French and Spanish.

          EssentialPIM有Pro版和Free版,功能自然是有差別了,但對于我來說,Free就完全夠用了。

          posted @ 2008-12-06 20:37 云自無心水自閑 閱讀(526) | 評論 (0)編輯 收藏

          僅列出標題
          共29頁: First 上一頁 11 12 13 14 15 16 17 18 19 下一頁 Last 
          主站蜘蛛池模板: 额尔古纳市| 延寿县| 桑植县| 洛隆县| 保山市| 南和县| 克什克腾旗| 彰武县| 尼勒克县| 河北省| 长海县| 台山市| 堆龙德庆县| 黑河市| 饶河县| 伊金霍洛旗| 平邑县| 常德市| 弋阳县| 永平县| 西林县| 广元市| 武平县| 顺义区| 沙雅县| 新营市| 安国市| 奉节县| 古蔺县| 洮南市| 景洪市| 进贤县| 香格里拉县| 昭觉县| 静海县| 柳河县| 石屏县| 固安县| 绍兴县| 怀柔区| 邢台县|