fckeditor在线编辑器

fckeditor在线编辑器

第一步:首先在项目sec目录下建立一个fckeditor.properties,内容如下
<span style="font-size:18px;">connector.userFilesPath=UploadFile
connector.userActionImpl=net.fckeditor.requestcycle.impl.UserActionImpl</span>
第二步:在webRoot下lib文件夹下导入Jar包
第三步导入文件夹

当然可以到这里去下载这个文件
第四步:在index.jsp中访问,代码如下
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.fckeditor.net" prefix="fck"  %>
<%
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="styles.css">
	-->
  </head>
  
  <body>
   
    <form id="form1" name="form1" method="post" action="fckeditor.jsp"> 
     文章标题  <input name="title" type="text" id="title" size="60"><BR/>
     文章正文:
     <fck:editor instanceName="ArtContent" width="700" height="350">
     <jsp:attribute name="value"></jsp:attribute>
     
     </fck:editor>
     <input type="submit" name="submit" value="提交">
    </form>
  </body>
</html>
index.jsp界面如下:

如果访问test.jsp,代码如下
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

    String content=request.getParameter("edt1");
    if (content != null) {
          content = content.replaceAll("\r\n", "");
          content = content.replaceAll("\r", "");
          content = content.replaceAll("\n", "");
          content = content.replaceAll("\"", "'");
    }else{
          content = "";
    }
    content = new String(content.getBytes("iso8859-1"),"utf-8");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <base href="<%=basePath%>">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>fck 测试</title>
 <script type="text/javascript" src="fckeditor/fckeditor.js"></script>
</head>
<body>
    <form method="post" name="frm1">
    <FCK:editor height="400" instanceName="edt1" value="<%=content%>" toolbarSet="Basic">
        <FCK:config SkinPath="skins/office2003/"/>
    </FCK:editor>
    <input type="submit" value="提交">
    </form>
    <hr>
    <%=content%>
</body>
</html>
界面如下

总结:所需jar包及文件都在 http://pan.baidu.com/s/1hsvv7gg
这就是编辑器,今后只需要在自己 的项目中引用就可以了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值