Kindeditor (JSP) & upload directory does not exist

Source: Internet
Author: User

First, the basic configuration

Kindeditor is a rich text editor, the role of the blog Garden to write articles with this editor, is to let the text into a variety of decoration elements.

Use the following method, unzip, delete the Asp\net\php folder in the interim, then create a new folder under the Web Project/kindeditor, and then drag the file into:

The directory structure is as above.

Add the following code to the JSP that needs to import Kindeditor

1 <!--Kindeditor - 2          <ScriptCharSet= "Utf-8"src= "Kindeditor/kindeditor.js" ></Script>3         <ScriptCharSet= "Utf-8"src= "Kindeditor/lang/zh_cn.js"></Script> 4         <Script>5             varEditor;6 Kindeditor.ready (function(K) {7 Editor=K.create ('textarea[name= "Content"]',{8 Allowfilemanage:true ,9 Uploadjson:'kindeditor/jsp/upload_json.jsp',Ten Filemanagerjson:'kindeditor/jsp/file_manager_json.jsp', One Afterblur:function() { A                      This. sync (); - K.ctrl (document, -, function() { - K ('form[name= "MyForm"]')[0].submit (); the                     }); - K.ctrl ( This. Edit.doc, -, function() { - K ('form[name= "MyForm"]')[0].submit (); -                     }); +                     } -                 }); +             }); A         </Script>

INSERT into

Then write in the location of the Insert editor:

  <id= "Content  " name= "Content"  rows= ""  cols= ""  style= "width:800px; height:360px; visibility:hidden;" ></ textarea >

The mid-term rows cols is used to specify the length-width.

and name to and from the previous section of the Code

K.create (' textarea[name= ' content "] ', {

Consistent.


This completes the basic configuration.
Second, file and image upload
At first think Kindeditor upload method to write my own, I have pulled out my javase book prepared with IO to do a big, and later found Kindeditor has integrated this piece of code, "otherwise also distinguish what asp\php what to do?"
First, the jar under Jsp/lib is imported into the path, and then
The logic of the upload mainly look at two files

Well, let's just test the function first.

Oh

Okay, look at the code.

Upload_json.jsp Down path error?
Specifically, we're talking about our savepath.

Solution:
1. Modify Savepath to
Request.getsession (). Getservletcontext (). Getrealpath ("/") + "kindeditor/attached/";

The original method of obtaining the path may be problematic, and this ensures that the path is not faulted.

2, the corresponding path may not have the corresponding folder, manually create a new one.

Above, is I yesterday use kindeditor encounter problem, hope can help to everyone, write blog for the first time not good, may be a bit unscientific no logic, forgive me ha

In addition I am a sophomore student, I hope you learn the Java EE can be here to learn communication (HEE)

Kindeditor (JSP) & upload directory does not exist

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.