Ueditor for Java configuration (SPRINGMVC)

Source: Internet
Author: User


Ueditor version:1.4.32


The Web project is named Home, and the folder under the root path of the project is created under Ue,ue ueditor file.

Under UE placed a custom test for the ueditor.html file, the file is defined as follows

<! Doctype html>


Create one of the following handler

@RequestMapping ("/ue/upload.action") public void Upload (httpservletrequest request,httpservletresponse response)  Throws ioexception{request.setcharacterencoding ("Utf-8");  Response.setheader ("Content-type", "text/html");  String RootPath = Pathutil.root_path;  Log.debug ("Ueditor Upload, rootpath:{}", RootPath);  Actionenter action = new Actionenter (request, RootPath);  String res = action.exec ();  Log.debug ("Ueditor upload operation result: {}", res); Response.getwriter (). Print (res); }


In Ueditor.config.js, modify the ServerURL configuration, format Serverurl:url + "Upload.action". This path is the request path of the UE during the upload operation.

Note: The URL variable ueditor here is automatically set to the path of the page where the UE editor is located. Since the UE editor is located in the ueditor.html under UE, the URL is .../ue


Modify the Imageurlprefix and Imagepathformat values inside the Config.json. As follows:
"Imageurlprefix": "/Home",
"Imagepathformat": "/ue/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",


To enable the UE editor to use the upload feature, we need to ensure that access to the following address successfully returns the correct JSON data
http://localhost:8080/home/ue/upload.action? action=config

Its data format (partial content):

{"Videomaxsize": 102400000, "Videoactionname": "Uploadvideo", "Fileactionname": "UploadFile", "Filemanagerlistpath": "/home/ueditor/jsp/upload/file/", "Imagecompressborder": "The", "Imagemanagerallowfiles": [". png", ". jpg", ". jpeg", ". GIF ",". bmp "]," Imagemanagerlistpath ":"/home/ueditor/jsp/upload/image/"," filemaxsize ": 51200000," Filemanagerallowfiles ": [". png ",". jpg ",". jpeg ",". gif ",". bmp ",". flv ",". SwF ",". mkv ",". avi ",". Rm ",". rmvb ",". Mpeg ", ". mpg", ". Ogg", ". Ogv", ". mov", ". wmv", ". mp4", ". WebM", ". mp3", ". wav", ".", ". rar", ". zip", ". Tar", ". Gz", ". 7z", ". bz2" , ". Cab", ". iso", ". Doc", ". docx", ". xls", ". xlsx", ". ppt", ". pptx", ". pdf", ". txt", ". MD", ". xml", ". ":" ListFile "," snapscreeninsertalign ":" None "," Scrawlactionname ":" Uploadscrawl "," Videofieldname ":" Upfile "," Imagecompressenable ": True," Videourlprefix ":" "," Filemanagerurlprefix ":" "," catcherallowfiles ": [". png ",". jpg ",". JPEG ",". gif ",". bmp "]," imagemanageractionname ":" ListImage "," Snapscreenpathformat ":"/ueditor/jsp/upload/image/{ Yyyy}{mm}{dd}/{time}{rand:6} "," SCRawlpathformat ":"/home/ue/jsp/upload/image/{yyyy}{mm}{dd}/{time} 

Because in the Java code that the UE provides the upload function, when obtains the file information the first is obtains the Config.json file, and according to the processing logic obtains the request path the Config.json file, here is .../home/ The Config.json file below the UE path. But since the file was actually placed under the home/ue/jsp path, I copied the Config.json file to .../home/ue.


At this point, the configuration is complete and runs smoothly.


This article comes from the "Simple and Easy" blog, so be sure to keep this source http://dengshuangfu.blog.51cto.com/8794650/1783086

Ueditor for Java configuration (SPRINGMVC)

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.