Search code examples
javajspckeditorfckeditor

update ckeditor and integrate it with jsp


I was working with an old version of ckeditor (fckeditor 2.x) integrated in a java project with jsp and struts framework. Now I need to update the project with a new version of ckeditor. I've tried to do it as stated in the documentation here but is not working as it should.

I've downloaded the most recent ckeditor and placed it in the web application directory, then I downloaded the jar file, placed it in WEB-INF/lib folder and add it to the project on eclipse.

In the jsp file I'm adding:

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

and then in the body I'm trying to something close to this: (inside a "multipart/form-data" form)

<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>

This is exactly the way I used to do, and IT IS WORKING PROPERLY with the version 2.x. As some properties are not accepted anymore, I've tried something like this.

<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>

I've tried the simple example below, and the the output still a normal text area.

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

I guess I'm forgetting something on configs or just some tags missing in the jsp, I've already googled it and read every question here, but I can't figure it out by myself.


Solution

  • I've already find the answer. For anyone interested, it is just simple as this with the new version 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>