Integrated Rich text editor for JSP pages
Download--Delete Redundant components--add to project--refer to the case to complete the integration
Steps:
1. Unzip the zip file and copy all the files to the Tomcat Webapps/kindeditor directory.
2. Copy the 3 jar files under the Kindeditor/jsp/lib directory into the Tomcat Lib directory and restart Tomcat.
* Commons-fileupload-1.2.1.jar
* Commons-io-1.4.jar
* Json_simple-1.1.jar
The following is an example of a sub-text editor i downloaded
3. Paste the integration representative below into the target file (remember to modify the necessary data)
The code is as follows:
<link rel= "stylesheet" href= "<%=request.getcontextpath ()%>/kindeditor/themes/default/default.css"/>
<link rel= "stylesheet" href= "<%=request.getcontextpath ()%>/kindeditor/plugins/code/prettify.css"/>
<script charset= "Utf-8" src= "<%=request.getcontextpath ()%>/kindeditor/kindeditor.js" ></script>
<script charset= "Utf-8" src= "<%=request.getcontextpath ()%>/kindeditor/lang/zh_cn.js" ></script>
<script charset= "Utf-8" src= "<%=request.getcontextpath ()%>/kindeditor/plugins/code/prettify.js" >< /script>
<script>
Kindeditor.ready (function (K) {
Here the name is the name of the rich text field, the name used to fetch the data in the background
var editor1 = k.create (' textarea[name= "context"] ', {
Csspath: ' <%=request.getcontextpath ()%>/kindeditor/plugins/code/prettify.css ',
Uploadjson: ' <%=request.getcontextpath ()%>/kindeditor/jsp/upload_json.jsp ',
Filemanagerjson: ' <%=request.getcontextpath ()%>/kindeditor/jsp/file_manager_json.jsp ',
Allowfilemanager:true,
Aftercreate:function () {
var = this;
K.ctrl (document, function () {
Self.sync ();
Note Modify the name of the form form here
document.forms[' Nameform '].submit ();
});
K.ctrl (Self.edit.doc, +, function () {
Self.sync ();
document.forms[' Nameform '].submit ();
});
}
});
Prettyprint ();
});
</script
4. Run the project and the effect is out.
Integrate a rich text editor for Web projects