kindeditor用法简单介绍(转)
1,首先去官網(wǎng)下載http://www.kindsoft.net/?
2,解壓之后如圖所示:
?
?
由于本人做的是用的是JSP,所以ASP,PHP什么的就用不上了,直接把那些去掉然后將整個(gè)文件夾扔進(jìn)Myeclipse,如圖:
?
?
里面有個(gè)報(bào)錯(cuò),估計(jì)是我自己IDE的問(wèn)題,沒(méi)有處理照常使用。
3,就可以開(kāi)工寫JSP了,下面把自己的一個(gè)JSP的代碼貼出來(lái),頁(yè)面代碼神馬的不太規(guī)范,湊合著當(dāng)示例,能跑通就行;
<%@?page?language="java"?import="java.util.*"?pageEncoding="UTF-8"%>
<%
String?path?=?request.getContextPath();
String?basePath?=?request.getScheme()?+?"://"
+?request.getServerName()?+?":"?+?request.getServerPort()
+?path?+?"/";
%>
<!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN">
?
?
<html>
<head>
<base?href="<%=basePath%>">
?
<title>My?JSP?'index.jsp'?starting?page</title>
?
<meta?http-equiv="pragma"?content="no-cache">
<meta?http-equiv="cache-control"?content="no-cache">
<meta?http-equiv="expires"?content="0">
<meta?http-equiv="keywords"?content="keyword1,keyword2,keyword3">
<meta?http-equiv="description"?content="This?is?my?page">
?
<link?rel="stylesheet"?type="text/css"?href="css/layout.css">
<link?rel="stylesheet"?href="kindeditor/themes/default/default.css"?/>
<link?rel="stylesheet"?href="kindeditor/plugins/code/prettify.css"?/>
<script?charset="utf-8"?src="kindeditor/kindeditor.js">
</script>
<script?charset="utf-8"?src="kindeditor/lang/zh_CN.js">
</script>
<script?charset="utf-8"?src="kindeditor/plugins/code/prettify.js">
</script>
<script>
KindEditor.ready(function(K)?{
var?editor1?=?K.create('textarea[name="article.content1"]',?{
cssPath?:?'kindeditor/plugins/code/prettify.css',
uploadJson?:?'kindeditor/jsp/upload_json.jsp',
fileManagerJson?:?'kindeditor/jsp/file_manager_json.jsp',
allowFileManager?:?true,
afterCreate?:?function()?{
var?self?=?this;
K.ctrl(document,?13,?function()?{
self.sync();
document.forms['example'].submit();
});
K.ctrl(self.edit.doc,?13,?function()?{
self.sync();
document.forms['example'].submit();
});
}
});
prettyPrint();
});
</script>
</head>
?
<body>
<div?id="container">
<div?id="header">
</div>
<div?id="menu">
<ul>
<li>
<a?href="main.jsp">首頁(yè)</a>
</li>
<li>
<a?href="jsp/update_password.jsp">個(gè)人信息</a>
</li>
<li>
<a?href="jsp/article_add.jsp">提交論文</a>
</li>
<li>
<a?href="article_returnList.action">審批論文</a>
</li>
<li>
<a?href="#">后臺(tái)管理</a>
</li>
</ul>
</div>
<div?id="mainContent">
?
<form?name="example"?method="post"?action="article_add.action">
題目:
<input??type="text"?name="article.title">
<br?/>
內(nèi)容:
<textarea?name="article.content1"?cols="100"?rows="8"
></textarea>
<br?/>
<input?type="submit"?name="button"?value="提交"?/>
(提交快捷鍵:?Ctrl?+?Enter)
</form>
</div>
<div?id="footer">
Copyright?2012?by?Lai?Xuansi.
</div>
</div>
</body>
</html>
?
?
?
5,關(guān)于數(shù)據(jù)庫(kù)和上傳本地圖片問(wèn)題
Kindeditor對(duì)于上傳的圖片神馬的會(huì)默認(rèn)保存在attached文件夾中,至于數(shù)據(jù)庫(kù)字段中存儲(chǔ)的只是圖片的地址,所以將內(nèi)容讀取出來(lái)的時(shí)候,只要讀取數(shù)據(jù)庫(kù)字段中的內(nèi)容就會(huì)自動(dòng)將文本和圖片等一起顯示出來(lái)了,很好很強(qiáng)大!要注意的就是讀取數(shù)據(jù)庫(kù)出來(lái)之后要將地址轉(zhuǎn)換成HTML代碼才能正確顯示,這個(gè)工作很簡(jiǎn)單,只要:<s:property?value="article.content1"?escape="false"?/>將escape="false"?就OK了。
分類:?Java轉(zhuǎn)載于:https://www.cnblogs.com/ziyandeyanhuo/p/7877556.html
總結(jié)
以上是生活随笔為你收集整理的kindeditor用法简单介绍(转)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: qstring去掉特定字符_如何花式、批
- 下一篇: android 滚动尺画到控件中间,an