Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 更新ckeditor并将其与jsp集成_Java_Jsp_Ckeditor_Fckeditor - Fatal编程技术网

Java 更新ckeditor并将其与jsp集成

Java 更新ckeditor并将其与jsp集成,java,jsp,ckeditor,fckeditor,Java,Jsp,Ckeditor,Fckeditor,我使用的是一个旧版本的ckeditor(fckeditor 2.x),它集成在一个带有jsp和struts框架的java项目中。 现在我需要用新版本的ckeditor更新项目。我已经试着按照文档中的说明去做,但并没有达到应有的效果 <tr> <td class="celltitle"> <strong>Example2 </strong> </td> <td class="cellconte

我使用的是一个旧版本的ckeditor(fckeditor 2.x),它集成在一个带有jsp和struts框架的java项目中。 现在我需要用新版本的ckeditor更新项目。我已经试着按照文档中的说明去做,但并没有达到应有的效果

<tr>
    <td class="celltitle">
        <strong>Example2 </strong>
    </td>
    <td class="cellcontent">
        <textarea class="ckeditor" name="example2"></textarea>
    </td>
</tr>
我下载了最新的ckeditor并将其放置在web应用程序目录中,然后下载了jar文件,将其放置在web-INF/lib文件夹中,并将其添加到eclipse上的项目中

<tr>
    <td class="celltitle">
        <strong>Example2 </strong>
    </td>
    <td class="cellcontent">
        <textarea class="ckeditor" name="example2"></textarea>
    </td>
</tr>
在我要添加的jsp文件中:

<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>
<tr>
    <td class="celltitle">
        <strong>Example2 </strong>
    </td>
    <td class="cellcontent">
        <textarea class="ckeditor" name="example2"></textarea>
    </td>
</tr>

然后在主体中,我试图找到一些类似的东西:(在“多部分/表单数据”表单中)

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

这正是我过去的做法,它在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>
<tr>
    <td class="celltitle">
        <strong>Example2 </strong>
    </td>
    <td class="cellcontent">
        <textarea class="ckeditor" name="example2"></textarea>
    </td>
</tr>

我尝试了下面的简单示例,输出仍然是一个普通的文本区域

<textarea cols="80" id="editor1" name="editor1" rows="10"></textarea>               
<ckeditor:replace replace="editor1" basePath="/ckeditor/" />
<tr>
    <td class="celltitle">
        <strong>Example2 </strong>
    </td>
    <td class="cellcontent">
        <textarea class="ckeditor" name="example2"></textarea>
    </td>
</tr>


我想我忘记了配置上的一些东西,或者只是jsp中缺少了一些标记,我已经在谷歌上搜索了它,并阅读了这里的每个问题,但我自己无法找到答案。

我已经找到了答案。对于任何感兴趣的人来说,使用新版本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>

示例1
(……)

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

示例2

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

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