带弹簧MVC的ckeditor无法正常工作 [英] ckeditor with spring mvc not working

查看:72
本文介绍了带弹簧MVC的ckeditor无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将ckeditor与spring mvc项目集成在一起,但似乎没有用。据我所知,我正在按照文档进行操作,但是出了点问题。我得到的唯一输出是没有工具栏或类似ckeditor的文本区域。如果我指定完整工具栏,则保持不变。看起来好像没有找到ckeditor,但是为什么?



注意:在我的servlet-context.xml中我都尝试过

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

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

仍未找到。



1)我在eced中的eceditor 3.6.6位于webapp目录下。我复制了下载中的所有文件。



2)我的jsp文件如下:

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

注意:我也尝试过将src引用为src = / resources / ckeditor / ...,但还是不行。

 < textarea id = editor1 name = editor1>< p& gt;初始值。< / p& gt;< / textarea> 
< br>


< script type = text / javascript>
CKEDITOR.replace('editor1',
{
工具栏:'Basic',
uiColor:'#9AB8F3'
});
< / script>


解决方案

我建议您检查参考路径。 / p>

您当前的路径显示ckeditor.js文件应位于 http://example.com/ckeditor/ckeditor.js ,但我假设它位于资源文件夹中。



尝试一下:

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

我发布了另一个有关引用资源应如何工作的答案。这应该可以帮助您弄清楚为什么它是404ing

如何正确引用HTML中的本地资源?



或者,您也可以尝试使用CDN托管文件。

但是:不能保证jsdelivr可以长期在线

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

还请注意,cdn中有更多插件,例如
http://www.jsdelivr.com/#!ckeditor


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>

解决方案

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

这篇关于带弹簧MVC的ckeditor无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆