upload file (3)

Tutorial on the use of Baidu's ueditor

1) Select the corresponding server version (I chose jsp), create a new ueditor folder under the WebRoot of the project, copy the content to the following, copy the jar package to the WEB-INF and buildpath

    1.1: Solve the error of importing some js files of ueidtor: uncheck the verification of js by myeclipse->windows->preference->myeclipse->validation

   1.2: An error occurred in config.json: remove the comment in the first sentence

 2) Introduce two js files editor_config.js and editor_all.js

<script type="text/JavaScript"src="./ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="./ueditor/editor_all.js"></script>

 

3) js creates an editable area to create an editor, you need to indicate the id, the type is text/plain, and finally the editor can be instantiated

  

<script id="Container" name="content" type="text/plain">
Write your initialization content here
 </script>
 <script type="text/javascript">

      var ue = UE.getEditor('Container');

   </script>
 4) Modify the URL in the config.js source code

 

   

var URL = window.UEDITOR_HOME_URL||"/demo1/ueditor/";
 For details, see: http://blog.csdn.net/gfd54gd5f46/article/details/60887313

 

5) Using ueditor in javaweb

    The corresponding input box in the form form, a declaration name, can be obtained according to the value of the name when the servlet is obtained

    In the absence of a declaration, for example:

  

<script id="Container" type="text/plain">    
 </script>
 When fetching in the background:

 

  

String content = request.getParameter("editorValue");
 6) Configure the upload image path

 

    6.1: Configuration of image path in config.json (see attachment)

             Easy mistake: The upload and echo path of the image should be written correctly '/'.

          

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326682478&siteId=291194637