先贴出代码
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="UTF-8"%>
<%@ page import="javax.servlet.http.HttpSession"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
Integer userType = 0;
%>
<--引入Easyui,kindeditor 的js文件-->
<script src="js/jquery.min.js"></script>
<script src="js/jquery.easyui.min.js"></script>
<script src="js/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" type="text/css" href="themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="themes/icon.css">
<link rel="stylesheet" href="js/kindeditor-4.1.10/themes/default/default.css">
<script charset="utf-8" src="js/kindeditor-4.1.10/kindeditor-min.js"></script>
<script charset="utf-8" src="js/kindeditor-4.1.10/lang/zh_CN.js"></script>
<head>
<body>
<!-- form表单 -->
<form action="/fileSaveAction" method="post">
<input type="submit" value="提交" onclick="save()"/>
<-- 文本框-->
<textarea id="saveId" name="content" style="width:800px;height:200px;border: 0 none;visibility:hidden;" charset="utf-8"></textarea>
</form>
<script language="JavaScript" type="text/javascript">
var editor;
KindEditor.ready(function(K) {
editor = K.create('textarea[name="content"]', {
resizeType : 1,
allowPreviewEmoticons : false,
items : [ 'source', '', 'undo','redo','','formatblock','fontname', 'fontsize', '',
'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
'strikethrough','removeformat', '', 'justifyleft', 'justifycenter',
'justifyright', 'insertorderedlist','insertunorderedlist','insertorderedlist',
'insertunorderedlist', '', 'emoticons', 'image', 'link','table','hr','preview'],
});
//清空KindEditor, 0表示第一个KindEditor编辑器对象
KindEditor.instances[0].html("");
});
function save(){
//获取文本框的值
editor.sync();
var html = document.getElementById('saveId').value;
alert(html);
document.forms[0].action="fileSaveAction.action?html="+html;
document.forms[0].submit;
}
</script>
</body>
</html>