1. http://ueditor.baidu.com/website/index.html ? 下載包
2.解壓然后放入自己項目目錄
?
?
?3.
<script type="text/javascript">
???window.UEDITOR_HOME_URL="${jspPath}/js/editor/";? //指向根目錄 初始化對象
</script>
?
?4.
<script type="text/javascript" src="${jspPath}/js/editor/editor_all.js"></script>
<script type="text/javascript" src="${jspPath}/js/editor/editor_config.js"></script>
<link rel="stylesheet" href="${jspPath}/js/editor/themes/default/css/ueditor.css">
?
?
<textarea id="summarys"?? rows="15" cols="120" name="summarys" onclick="testedior('summarys')">${summary}</textarea>
?
<script type="text/javascript">
?function testedior(id){
??new UE.ui.Editor({
???toolbars:[['fullscreen', 'source', '|', 'undo', 'redo', '|',
???????????????? 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch','autotypeset','blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist','selectall', 'cleardoc', '|',
???????????????? ,'lineheight','|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|','indent', '|',
???????????????? 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','touppercase','tolowercase','|',
???????????????? 'link', 'unlink', 'anchor', '|','imagecenter', '|','insertimage','pagebreak', '|',
???????????????? 'horizontal', 'date', 'time', 'spechars', '|','inserttable', 'deletetable', '|', 'preview','help']],
???????? initialFrameWidth:950,//寬度
???????? theme:"default", //皮膚
???autoFloatEnabled:false,//工具欄不隨著瀏覽器的滾動漂浮
???????? autoHeightEnabled:false,//內容不自動增高
???????? lang:'zh-cn' //語言
???? }).render(id);
?}
</script>
?5.
上傳圖片需要修改配置editor_config.js
里面的路徑
?//圖片上傳配置區
??????? ,imageUrl:URL+"file!bdupload.action?_charset_=utf-8"???????????? //圖片上傳提交地址
??????? ,imagePath:""???????????????????? //返回是網絡地址直接為空
??????? ,imageFieldName:"filedata"?????????????????? //圖片數據的key,若此處修改,需要在后臺對應文件修改對應參數
??????? //,compressSide:0??????????????????????????? //等比壓縮的基準,確定maxImageSideLength參數的參照對象。0為按照最長邊,1為按照寬度,2為按照高度
??????? //,maxImageSideLength:900??????????????????? //上傳圖片最大允許的邊長,超過會自動等比縮放,不縮放就設置一個比較大的值,更多設置在image.html中
?
?
java
?/**
? * 新編輯器
? * @return
? * @throws Exception
? */
?public String bdupload() throws Exception{
??admin=(Admin)ServletActionContext.getRequest().getSession().getAttribute("admin");
??ServletActionContext.getResponse().setContentType("text/html; charset=utf-8");
??? String path1="";
??? int nid=admin.getAdid();
??? if(filedata!=null){
???? path1 = fileService.newuploadPicture(filedata, filedataFileName, new int[] {550, 150},15,nid);
???}
??? String json="{\"title\":\"tt\",\"state\":\"SUCCESS\",\"url\":\""+path1+"\"}";?
???try {
????ServletActionContext.getResponse().getWriter().write(json);
???} catch (IOException e) {
????e.printStackTrace();
???}
??? return null;
? }
??????????
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
