更新ckeditor并将其与jsp集成

时间:2015-07-09 14:57:29

标签: java jsp ckeditor fckeditor

我正在使用jsp和struts框架集成在java项目中的旧版ckeditor(fckeditor 2.x)。 现在我需要使用新版本的ckeditor更新项目。我已尝试按照文档here中的说明执行此操作但未按预期工作。

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

在jsp文件中我添加:

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

然后在身体中我试图接近这个:(在&#34; multipart / form-data&#34;形式内)

<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搜索并阅读了这里的每个问题,但我无法自己解决这个问题。

2 个答案:

答案 0 :(得分:1)

我已经找到了答案。对于任何感兴趣的人来说,这很简单,因为新版本的确定了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>

答案 1 :(得分:0)

主要问题在于basePath标记。它应该正确指向你的ckeditor.js位置。