fckeditor在线编辑器

fckeditor在线编辑器

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

当然可以到这里去下载这个文件
http://pan.baidu.com/s/1hsvv7gg
第四步:在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界面如下:
fckeditor在线编辑器_第3张图片
如果访问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>
界面如下
fckeditor在线编辑器_第4张图片
总结:所需jar包及文件都在 http://pan.baidu.com/s/1hsvv7gg
这就是编辑器,今后只需要在自己 的项目中引用就可以了
 
 

你可能感兴趣的:(jar,fckeditor,编辑器)