各位大哥、姐姐,您们好,实在头痛,个人自己能力有待提高啊。我在使用kindeditor-4.1.4上传图片时遇到下面这问题:
这时使用在线编辑器的文件:addlist.jsp
<html>
<head>
<%@ page
language="java"
contentType="text/html; charset=GB18030"
pageEncoding="GB18030"
%>
<%
request.setCharacterEncoding("GB18030");
String htmlData = request.getParameter("content") != null ? request.getParameter("content") : "";
%>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title></title>
<style type="text/css">
</style>
<script language="JavaScript">
</script>
<script charset="GB18030" src="editor/kindeditor.js"></script><!--在线编辑器相关-->
<script charset="GB18030" src="editor/lang/zh_CN.js"></script>
<link rel="stylesheet" href="editor/themes/default/default.css" />
<link rel="stylesheet" href="editor/plugins/code/prettify.css" />
<script charset="GB18030" src="editor/plugins/code/prettify.js"></script>
<script>
var editor;
KindEditor.ready(function(K) {
editor = K.create('#editor_id');
});
// 取得HTML内容
html = editor.html();
// 同步数据后可以直接取得textarea的value
editor.sync();
html = document.getElementById('editor_id').value; // 原生API
html = K('#editor_id').val(); // KindEditor Node API
html = $('#editor_id').val(); // jQuery
// 设置HTML内容
editor.html('HTML内容');
KindEditor.ready(function(K) {
var editor1 = K.create('textarea[name="content"]', {
cssPath : 'editor/plugins/code/prettify.css',
uploadJson : 'editor/jsp/upload_json.jsp',
fileManagerJson : 'editor/jsp/file_manager_json.jsp',
allowFileManager : true,
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
document.forms['form1'].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
document.forms['form1'].submit();
});
}
});
prettyPrint();
});
</script>
</head>
<jsp:useBean id="ca" class="base.Calend" scope="page"></jsp:useBean>
<jsp:useBean id="chus" class="base.CheckAdmin" scope="page"></jsp:useBean>
<%
String today = ca.getToday();
String m = request.getParameter("Meth");//显示左上角的当前分类
//String userName = request.getParameter("userName");
String userName=(String) session.getValue("userName");//取session中的密码
String userPass=(String) session.getValue("userPass");//取session中的密码
//out.println(userPass);
int is = chus.getLogin(userName,userPass);//is是用户表中对应的id
if(is<=0)//验证用户登录,好像没有生效。
{
out.print("<script>alert('用户名密码错误!')</script>");
out.print("<script>open('../login.jsp','_parent')</script>");
}
%>
<body bgcolor="#F2F2F2" onLoad="">
<table width="98%" border="0" align="center">
<tr>
<td height="30" colspan="2"><%=titleStr%></td>
</tr>
<tr>
<td height="20" colspan="2"></td>
</tr>
<tr>
<td >
<form name='form1' action="oplist.jsp?id=1&Meth=add" method='post' target='_self' onSubmit='return checkinfo(this);'>
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='10%' height='25' align='right'>题名:</td>
<td width="80%"><input name='t1' type='text' size='50'></td>
</tr>
<tr>
<td height='25' align='right'>日期:</td>
<td><input name='t2' type='text' value="<%=today%>" size='30' >
<input type='button' name='button' value='日期' onClick='sdate();'></td>
</tr>
<%
if(m.equals("307")){
out.print("<tr><td height='25' align='right'>新闻图片:</td> <td><input name='t7' type='text' size='30' readonly></td> </tr> <tr><td height='25' align='right'></td><td> <iframe height='100' width='400' src='upMap.jsp' frameborder='0' name='addfir' scrolling='yes' background-color: #F2F2F2;></iframe></td></tr> ");
}
else
{
out.print("<tr><td height='25' align='right'></td> <td><input name='t7' type='hidden' size='50' value='0'></td> </tr>");