我正在使用旧版本的ckeditor(fckeditor 2.x)集成到具有jsp和struts框架的Java项目中。
现在,我需要使用新版本的ckeditor更新项目。我已经尝试按照文档here中的说明进行操作,但是无法正常工作。

我已经下载了最新的ckeditor并将其放置在Web应用程序目录中,然后下载了jar文件,并将其放置在WEB-INF / lib文件夹中,并将其添加到eclipse上的项目中。

在jsp文件中,我要添加:

<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>


然后在正文中尝试接近以下内容:(在“ multipart / form-data”表单中)

<td class="cellcontent">
     <bean:define id="propertyValueId" name="formName" property="example" />
    <ckeditor:editor instanceName="example" toolbarSet="Default" height="200px">
        <jsp:attribute name="value">
            <c:out value="${propertyValueId}" escapeXml="false"></c:out>
        </jsp:attribute>
    </ckeditor:editor>
</td>


这正是我以前的工作方式,并且它与2.x版本可以正常工作。由于不再接受某些属性,因此我尝试了类似的方法。

<td class="cellcontent">
    <bean:define id="propertyValueId" name="formName" property="example" />
    <ckeditor:editor basePath="/ckeditor/" editor="content"  >
        <jsp:attribute name="value">
            <c:out value="${propertyValueId}" escapeXml="false"></c:out>
        </jsp:attribute>
    </ckeditor:editor>
</td>


我已经尝试了下面的简单示例,并且输出仍然是普通文本区域。

<textarea cols="80" id="editor1" name="editor1" rows="10"></textarea>
<ckeditor:replace replace="editor1" basePath="/ckeditor/" />


我想我忘记了配置中的某些内容,或者只是jsp中缺少的一些标签,我已经在Google上搜索并阅读了这里的每个问题,但我自己无法弄清楚。

最佳答案

我已经找到答案了。对于任何感兴趣的人来说,使用新版本的ok ckeditor就像这样简单:

<ckeditor:editor basePath="<%=ckeditor_context %>" editor="content" />

<tr>
    <td class="celltitle">
        <strong>Example1 </strong>
    </td>
    <td class="cellcontent">
        <textarea class="ckeditor" name="example1"></textarea>
    </td>
</tr>


(...)

<tr>
    <td class="celltitle">
        <strong>Example2 </strong>
    </td>
    <td class="cellcontent">
        <textarea class="ckeditor" name="example2"></textarea>
    </td>
</tr>

10-08 13:35
查看更多