資源簡介
剛剛接觸UEditor,想找一個可運行的jsp版本,網(wǎng)上下載很多,浪費了20多分,依然不行啊。后來自己按照網(wǎng)上的文檔一步一步添加,終于可行。現(xiàn)在可以上傳圖片、文字和視頻,后期準備添加音頻,加油

代碼片段和文件信息
package?upload;
import?java.io.IOException;
import?java.io.PrintWriter;
import?javax.servlet.ServletException;
import?javax.servlet.http.HttpServlet;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
public?class?UeditorServlet?extends?HttpServlet?{
/**
?*?Constructor?of?the?object.
?*/
public?UeditorServlet()?{
super();
}
/**
?*?Destruction?of?the?servlet.?
?*/
public?void?destroy()?{
super.destroy();?//?Just?puts?“destroy“?string?in?log
//?Put?your?code?here
}
/**
?*?The?doGet?method?of?the?servlet.?
?*
?*?This?method?is?called?when?a?form?has?its?tag?value?method?equals?to?get.
?*?
?*?@param?request?the?request?send?by?the?client?to?the?server
?*?@param?response?the?response?send?by?the?server?to?the?client
?*?@throws?ServletException?if?an?error?occurred
?*?@throws?IOException?if?an?error?occurred
?*/
/**
?????*?用于接收form表單中的editorValue值
?????*?@see?HttpServlet#doGet(HttpServletRequest?request?HttpServletResponse?response)
?????*/
????protected?void?doGet(HttpServletRequest?request?HttpServletResponse?response)?throws?ServletException?IOException?{
????????//設(shè)置請求和響應(yīng)的編碼統(tǒng)一為UTF-8
???? System.out.println(“============“);
????????request.setCharacterEncoding(“UTF-8“);
????????response.setContentType(“text/html;charset=UTF-8“);
????????//拿到編輯器的內(nèi)容
????????String?content?=?request.getParameter(“editorValue“);
????????//如果不為空
????????if(content?!=?null){
????????????//將內(nèi)容設(shè)置進屬性
????????????request.setAttribute(“content“content);
????????????//轉(zhuǎn)發(fā)到content.jsp
????????????request.getRequestDispatcher(“content.jsp“).forward(request?response);
????????}else{
????????????response.getWriter().append(“內(nèi)容為空!“);
????????}
????}
/**
?*?The?doPost?method?of?the?servlet.?
?*
?*?This?method?is?called?when?a?form?has?its?tag?value?method?equals?to?post.
?*?
?*?@param?request?the?request?send?by?the?client?to?the?server
?*?@param?response?the?response?send?by?the?server?to?the?client
?*?@throws?ServletException?if?an?error?occurred
?*?@throws?IOException?if?an?error?occurred
?*/
public?void?doPost(HttpServletRequest?request?HttpServletResponse?response)
throws?ServletException?IOException?{
doGet(request?response);
}
/**
?*?Initialization?of?the?servlet.?
?*
?*?@throws?ServletException?if?an?error?occurs
?*/
public?void?init()?throws?ServletException?{
//?Put?your?code?here
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????796??2017-08-01?16:20??UEditor\.classpath
?????文件???????1040??2017-08-01?16:20??UEditor\.project
?????文件????????503??2017-08-01?16:20??UEditor\.settings\.jsdtscope
?????文件????????395??2017-08-01?16:20??UEditor\.settings\org.eclipse.jdt.core.prefs
?????文件????????464??2017-08-01?16:20??UEditor\.settings\org.eclipse.wst.common.component
?????文件????????353??2017-08-01?16:20??UEditor\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2017-08-01?16:20??UEditor\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2017-08-01?16:20??UEditor\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件???????2611??2017-08-01?16:47??UEditor\src\upload\UeditorServlet.java
?????文件????????576??2017-08-02?09:20??UEditor\WebContent\content.jsp
?????文件???????7195??2017-08-01?16:44??UEditor\WebContent\index.jsp
?????文件?????????39??2017-08-01?16:20??UEditor\WebContent\me
?????文件????????632??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\demo.html
?????文件????????779??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\demo.html.bak
?????文件???????1627??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\anchor\anchor.html
?????文件??????15063??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\attachment.css
?????文件???????2370??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\attachment.html
?????文件??????30055??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\attachment.js
?????文件????????923??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_chm.gif
?????文件????????841??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_default.png
?????文件???????1012??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_doc.gif
?????文件????????949??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_exe.gif
?????文件????????950??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_jpg.gif
?????文件????????986??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_mp3.gif
?????文件???????1001??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_mv.gif
?????文件????????996??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_pdf.gif
?????文件???????1001??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_ppt.gif
?????文件???????1009??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_psd.gif
?????文件???????1007??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_rar.gif
?????文件????????970??2017-08-01?16:20??UEditor\WebContent\utf8-jsp\dialogs\attachment\fileTypeImages\icon_txt.gif
............此處省略340個文件信息
評論
共有 條評論