日期:2014-05-16 浏览次数:20360 次
<script type="text/javascript" src="ckeditor/ckeditor.js"></script> <!--这里根据实际情况来写路径,可以加上项目绝对路径,request.getContextPath()--> <textarea class="ckeditor" name="editor1"></textarea> <!--这是使用class方式实现--> <textarea cols="80" id="editor1" name="editor1" rows="10"></textarea> <script type="text/javascript">CKEDITOR.replace( 'editor1' );</script> <!--这是使用JS替换方式,如果这段代码要放到header里面的话,记得在body的onload里面调用--> <script type="text/javascript"> var editor01 = new FCKeditor(editor01); editor.BasePath = "/test/fckeditor/" Editor01.create(); </script> <!--这是使用JS生成方式,代码是老版本的代码,在新版里面已经看不到demo了所以建议不使用-->
<% String value = "My first <strong>CKEditor</strong> Java tag"; Map<String, String> attr = new HashMap<String, String>(); attr.put("rows", "8"); attr.put("cols", "50"); CKEditorConfig settings = new CKEditorConfig(); settings.addConfigValue("width", "500"); settings.addConfigValue("toolbar", "Basic"); %> <ckeditor:editor textareaAttributes="<%=attr %>" basePath="../ckeditor/" config="<%=settings %>" editor="editor1" value="<%= value %>"/>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %> <textarea cols="80" id="editor1" name="editor1" rows="10"></textarea> <ckeditor:replace replace="editor1" basePath="../ckeditor/" />