Integrate a rich text editor for Web projects

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.