2

I'm trying to integrate ckeditor with a spring mvc project and it does not seem to be working. As far as I can tell I'm following the documentation but something is wrong. The only output I get is a textarea with no toolbar or anything resembling ckeditor. This stays the same if I specify the "Full' toolbar. It appears as if ckeditor is not being found, but why?

Note: in my servlet-context.xml I have tried both

<resources mapping="/resources/**" location="/resources/" />

and

<resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>

and still not found.

1) I have ckeditor 3.6.6 in Eclipse under the webapp directory. I copied all the files from the download.

2) My jsp has the following:

 <head>
    <script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="/ckeditor/adapters/jquery.js"></script>
    <title>Home</title>
 </head>

note: I've also tried referring to the src as src="/resources/ckeditor/..." but still no go.

<textarea id="editor1" name="editor1">&lt;p&gt;Initial value.&lt;/p&gt;</textarea>
<br>


 <script type="text/javascript">
CKEDITOR.replace( 'editor1',
    {
        toolbar : 'Basic',
        uiColor : '#9AB8F3'
    });
   </script>
Chase Florell
  • 46,378
  • 57
  • 186
  • 376
Dave
  • 545
  • 3
  • 14
  • 29
  • can you load your page in Google Chrome and look at the console? Check first to see if any of your references are 404ing. – Chase Florell Jan 23 '13 at 18:25
  • Good idea! Yes the ckeditor references are 404ing. I'm also getting CKEDITOR not defined, but that's to be expected. Not sure why ckeditor is not being found. – Dave Jan 23 '13 at 18:44
  • It looks in your question like you're reference path to the ckeditor in the `src` is wrong. Make sure that your file/folder structure and reference is correct. Alternatively (see my answer) you can use a CDN. – Chase Florell Jan 23 '13 at 19:37
  • I'm not sure I understand. I'm not trying to update anything yet. I just want to see the fully functioning ckeditor on my web page. – Dave Jan 23 '13 at 19:41
  • I edited my comment and added an answer. – Chase Florell Jan 23 '13 at 19:42
  • I've edited again, I think I understand your issue now. – Chase Florell Jan 23 '13 at 21:00

1 Answers1

3

Might I suggest that you check your reference paths.

Your current path says that the ckeditor.js file should be located at http://example.com/ckeditor/ckeditor.js but I'm assuming that it's within a resources folder.

Try This:

<script type="text/javascript" src="/resources/ckeditor/ckeditor.js"></script>

I've posted another answer on how referencing resources should work. This should help you figure out why it's 404ing
How to properly reference local resources in HTML?

Alternatively, you can try the CDN hosted file.
however: there's no guarantee that jsdelivr will be online long term

<head>
   <script type="text/javascript" src="//cdn.jsdelivr.net/ckeditor/4.0.1/ckeditor.js"></script>
</head>

Also note, there are more plugins and such in the cdn
http://www.jsdelivr.com/#!ckeditor

Community
  • 1
  • 1
Chase Florell
  • 46,378
  • 57
  • 186
  • 376
  • That was it Chase! Thanks, I can't believe I didn't see that forward slash myself. This is what happens when you copy code while thinking about other problems. – Dave Jan 23 '13 at 21:30