關於struts2和fckeditor整合的總結

2021-05-22 16:46:33 字數 803 閱讀 6359

connectorservlet

com.info.fckeditor.fckeditor1

這裡我自己寫了個class,為的是防止用中文的副檔名的時候上傳的不能顯示,不過在2.6.6中它的connectorservlet.class有很大的變化,你要在dispatcher.class中去修改如:

中我新增了string filename = filenameutils.getname(uplfile.getname());

//檔案 的副檔名

string extension=filenameutils.getextension(filename);

//把檔名改為uuid字串,防止檔名中文時,上傳的無法顯示

filename=uuid.randomuuid().tostring()+"."+extension;

三句**,就能防止是中文的副檔名的不能顯示的問題了。

還有要注意的是在classpath中要有fckeditor.properties檔案裡面的內容可以從官網的文件能得到,

我在使用的時候和strut2整合的時候要特別注意的是在web.xml中的配置strut的過濾器要有所改變:

struts2

org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter

不能像以前的/*這樣的配置了,不然會報錯。

還有在專案的lib目錄下要有xalan-2.7.1.jar和xml-serializer-2.7.1.jar這兩個jar包,不然會出xml相關的異常

我的lib目錄:

關於hibernate和struts2結合的用法

關於乙個完整資料傳輸過程,即資料從頁面通過三層傳到資料庫,或者資料從資料庫通過三層傳到頁面,目前我使用了 兩個框架,這裡我做個總結。hibernate 相對於struts2,hibernate還是比較容易理解,即改變service層和dao層的結構,service層變化不大,主要是把sql改變成hq...

關於SpringMVC和Struts2的區別

1 springmvc的入口是乙個servlet即前端控制器,而struts2入口是乙個filter過慮器。2 springmvc是基於方法開發,傳遞引數是通過方法形參,可以設計為單例或多例 建議單例 struts2是基於類開發,傳遞引數是通過類的屬性,只能設計為多例。3 struts採用值棧儲存請...

Struts2字尾 深入Struts2

一 將action字尾變成html字尾 xmlversion 1.0 encoding utf 8 doctype struts public apache software foundation dtd struts configuration 2.1 en struts include file...