Use Rich Text editor Ueditor (open source text editor plugin) _ Rich Text editor in Project

Source: Internet
Author: User

The first step: Download all the files required by Ueditor

The Jsp-utf-8 version is used here

Download Link: http://ueditor.baidu.com/website/download.html

Step two: Unzip the download file to the Project Web directory

Step three: Copy the five jar packages under the/jsp/lib directory under the folder to the Web-inf/lib in the project and add them to the project structure

Fourth Step: Modify Ueditor.config.js

The var URL = window. Ueditor_home_url | | Getuebasepath ();

Modify to var URL = "/project name/utf8-jsp/";

Fifth step: Modify the image upload path prefix--ueditor directory Jsp/config.json

Change "" to "/project name" after Imageurlprefix

Picture upload path is can change not change

Step Sixth: Test index.html See if the text Editor can be displayed correctly on the Web page

Step seventh: Load the Ueditor into the Web page

The first step: Add the following two lines of code to the page where you want to add the text editor, and introduce the text editor configuration and source file

<!--config file-->
<script type= "Text/javascript" src= "/cms/utf8-jsp/ueditor.config.js" ></script>
<!--editor source files-->
<script type= "Text/javascript" src= "/cms/utf8-jsp/ueditor.all.js" ></ Script>

Step two: Introduce the text editor in the following code mode

<div align= "center" >
        <textarea id= "newseditor" name= "Content" style= "width:300px;height:200px" > </textarea>
        <br/>
        <script type= "Text/javascript" >
            ue.geteditor (' newseditor ');
        </script>
</div>

This approach is to create a text field as a container, then replace it with a text editor, and if you want to display existing content, add it to the textarea label and the counter tag

The eighth step: Open the Edit page, test whether the text editor can be normal display, test in the text to add pictures can be normal upload to the server corresponding items directory, if you can, Ueditor can already be used normally.

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.