PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/source/Plug-in/kind/jsp/demo.jsp

http://prosporous.googlecode.com/
JavaServer Pages | 56 lines | 56 code | 0 blank | 0 comment | 1 complexity | 1362fedc3383da91871035186559b61e MD5 | raw file
 1<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
 2<%
 3request.setCharacterEncoding("UTF-8");
 4String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
 5%>
 6<!doctype html>
 7<html>
 8<head>
 9	<meta charset="utf-8" />
10	<title>KindEditor JSP</title>
11	<link rel="stylesheet" href="../themes/default/default.css" />
12	<link rel="stylesheet" href="../plugins/code/prettify.css" />
13	<script charset="utf-8" src="../kindeditor.js"></script>
14	<script charset="utf-8" src="../lang/zh_CN.js"></script>
15	<script charset="utf-8" src="../plugins/code/prettify.js"></script>
16	<script>
17		KindEditor.ready(function(K) {
18			var editor1 = K.create('textarea[name="content1"]', {
19				cssPath : '../plugins/code/prettify.css',
20				uploadJson : '../jsp/upload_json.jsp',
21				fileManagerJson : '../jsp/file_manager_json.jsp',
22				allowFileManager : true,
23				afterCreate : function() {
24					var self = this;
25					K.ctrl(document, 13, function() {
26						self.sync();
27						document.forms['example'].submit();
28					});
29					K.ctrl(self.edit.doc, 13, function() {
30						self.sync();
31						document.forms['example'].submit();
32					});
33				}
34			});
35			prettyPrint();
36		});
37	</script>
38</head>
39<body>
40	<%=htmlData%>
41	<form name="example" method="post" action="demo.jsp">
42		<textarea name="content1" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;"><%=htmlspecialchars(htmlData)%></textarea>
43		<br />
44		<input type="submit" name="button" value="????" /> (?????: Ctrl + Enter)
45	</form>
46</body>
47</html>
48<%!
49private String htmlspecialchars(String str) {
50	str = str.replaceAll("&", "&amp;");
51	str = str.replaceAll("<", "&lt;");
52	str = str.replaceAll(">", "&gt;");
53	str = str.replaceAll("\"", "&quot;");
54	return str;
55}
56%>