茫茫網海中的冷日 - 對這文章發表回應
茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1729248 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_0186.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

對這文章發表回應

發表限制: 非會員 可以發表

發表者: 冷日 發表時間: 2008/9/21 10:42:07
在JSP中應用FCKeditor(2.1.1和FCKeditor.Java 2.3)

上次介紹了FCKeditor在asp中的應用,這次介紹它在jsp中的應用。

1. 將FCKeditor2.1.1解壓縮到項目的根目錄下,目錄結構為:\項目名\FCKeditor\ ,然後將FCKeditor-2.3.zip(java)壓縮包中\web\WEB-INF\lib\目錄下的兩個jar文件拷到項目的\WEB-INF\lib\目錄下。

2. 將FCKeditor-2.3.zip壓縮包中\web\WEB-INF\目錄下的web.xml文件合併到項目的\WEB-INF\目錄下的web.xml文件中。

3. 修改合併後的web.xml文件,將名為SimpleUploader的Servlet的enabled參數值改為true,以允許上傳功能,Connector Servlet的baseDir參數值用於設置上傳文件存放的位置。

4. 上面兩個servlet的映射分別為:
/editor/filemanager/browser/default/connectors/jsp/connector
/editor/filemanager/upload/simpleuploader
因為我的FCKeditor是放到\項目名\FCKeditor\目錄下,所以需要在兩個映射前面加上/FCKeditor,即改為
/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector
/FCKeditor/editor/filemanager/upload/simpleuploader。

5. 採用Taglib在jsp中添加如下代碼創建在線編輯器:
在頁面的頂部加入
<%@ taglib uri="http://fckeditor.net/tags-fckeditor" prefix="FCK" %>

在適當的位置加入下面代碼
<FCK:editor id="infoContent" basePath="/CM/FCKeditor/"
width="522"
height="300"
skinPath="/CM/FCKeditor/editor/skins/silver/"
defaultLanguage="zh-cn"
tabSpaces="8"
toolbarSet="CM"
imageBrowserURL="/CM/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="/CM/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
flashBrowserURL="/CM/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="/CM/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"
linkUploadURL="/CM/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"
flashUploadURL="/CM/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
請輸入內容
</FCK:editor>

注意/CM/,這個表示訪問項目的URL為http://127.0.0.1:8080/CM/,如果訪問的URL為:http://127.0.0.1:8080/ 的話,只需要將上面的/CM去掉就行,不用修改web.xml文件。

6. 經過上面步驟就可以在jsp中使用FCKeditor了。

===================================================================

另外,如果使用WebLogic,需要將FCKeditor-2.3.zip壓縮包中src目錄下的FCKeditor.tld文件提取出來,比如將其放到WEB-INF/tlds/目錄下,然後將jsp頁中的taglib語句修改為如下所示,就可以正常使用了:
<%@ taglib uri="/WEB-INF/tlds/FCKeditor.tld" prefix="FCK" %>


原文出處:郭成的BLOG
內容圖示
url email imgsrc image code quote
樣本
bold italic underline linethrough   












 [詳情...]
validation picture

注意事項:
預覽不需輸入認證碼,僅真正發送文章時才會檢查驗證碼。
認證碼有效期10分鐘,若輸入資料超過10分鐘,請您備份內容後,重新整理本頁並貼回您的內容,再輸入驗證碼送出。

選項

Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|