umeditor1.2.2 JSP version Change the image upload path method

Source: Internet
Author: User

Recently in doing a BBS project, need a lightweight editor, looked at the past, are Baidu editor pretty

How to deploy Baidu editor I just intercept part of the image, the key is to change the image upload path method

This is the deployment of Baidu editor need to introduce the JS file, directory to correspond

In the Web page needs to add this code where the editor, write a good style sheet, directly to the class introduction, the length of the editor will be adaptive, the following content will be in the Baidu editor after the initialization of the automatic filling in Baidu editor,

You can try it. The Name property is the field that the background accept form submission is used for getting content

Um.geteditor ("Myeditor"); This is the initialization of the Baidu editor, Myeditor is the above deployment when the ID written,

Come on, wait a minute.

I circled out of the place, could have been inserted Baidu map of the picture, but because of Baidu itself JS file error, so I in the configuration file canceled this feature, only need to modify the configuration file can be

I read a lot of online tutorials, I need to configure the URL, I have tested, do not configure the URL, on any page of the project can be deployed,

Without the introduction of a map, the editor does not show that function,

Below to get to the point, how to modify the image upload address, need to modify three places, remember to introduce the JSP directory Commons-fileupload-1.2.2.jar

Upload is the folder name that starts at the root of the Web site,

Secondly, modify the image fixup address in the editor configuration file and change to the start path of the website, because I use it in Tomcat so I use the IP address: Port number/project name is the site start path

So write a method to get the start path of the site

var rooturldir =url.substring (0,url.indexof ("/", Url.indexof ("/", Url.indexof ("://") +3) +1) +1);

http://127.0.0.1:8080/Project name/

Finally modify the physical path in the server through/to the site in Uploader.java to modify the completion

Maybe you haven't read it, I'll give you the analysis, the path is divided into three parts, http://127.0.0.1:8080/project name/upload/the folder name generated by time/the file name generated by time. Suffix Name

The Web page reference is the format, but the path to the disk is not this, so you need to map the disk path to save the picture.

For example, the project name under Tomcat is in the d:/tomcat/webapps/project name

After modification, the actual saved in d:/tomcat/webapps/upload/based on the time generated by the folder name/file name generated based on time. Suffix name

umeditor1.2.2 JSP version Change the image upload path method

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.