fckeditor通過action獲取數(shù)據(jù)庫中的內(nèi)容(10月15日)
Posted on 2010-10-17 21:54 石子路口 閱讀(598) 評(píng)論(0) 編輯 收藏 所屬分類: 網(wǎng)絡(luò)教學(xué)資源平臺(tái) 使用fckeditor是能夠上傳文章了,但是,如何才能從數(shù)據(jù)庫中重新讀取信息到fckeditor的編輯區(qū)域里去呢?可能我太愚鈍,網(wǎng)上關(guān)于這方面的解決方法竟然沒有找到。只能去找官方的幫助文檔,但又可能是這個(gè)問題過于簡(jiǎn)單,這方面的幫助信息也沒有找到。接下來唯一的辦法就是實(shí)例源碼,解壓縮下載的FCKeditor-2.3.rar,打開web文件夾下的_sample,sample02.jsp有這么一部分
<form action="sampleposteddata.jsp" method="get" target="_blank">
<FCK:editor id="EditorDefault" basePath="/FCKeditor/"
imageBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
flashBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"
linkUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"
flashUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
This is some <strong>sample text</strong>. You are using <a href="http://www.fredck.com/fckeditor/">FCKeditor</a>.
</FCK:editor>
<br>
<input type="submit" value="Submit">
</form>
其中的這一句“This is some <strong>sample text</strong>. You are using <a >FCKeditor</a>”顯示在頁面上就是“This is some sample text. You are using FCKeditor ”把這個(gè)文件放tomcat中執(zhí)行后,它顯示在了編輯區(qū)里。所以我使用struts2的標(biāo)簽<s:property> 同樣獲取了帶有格式的文章內(nèi)容,但顯示到編輯區(qū)的是帶有< >的標(biāo)簽和文本,所以意識(shí)到<s:property>是直接被顯示的,而不會(huì)經(jīng)過解釋。于是,想到,用java代碼來獲取內(nèi)容,并希望瀏覽器對(duì)其進(jìn)行解釋然后顯示,即把<s:property>所呆的地方換成<%=(String)request.getAttribute("mknr.content") %>。終于可以在編輯區(qū)顯示想要的內(nèi)容了。但這樣又在jsp頁面中寫進(jìn)java代碼了,都是自己所學(xué)不精,哪位仁兄告訴下ognl是否可以代替這句話呢?












