CKeditor的安装与使用 for jsp:
FCKeditor是一个专门使用在网页上属于开放源代码的所见即所得文字编辑器。
一、下载CKEditor
http://download.cksource.com/CKEditor/CKEditor/
打开连接往下拉,可以找到最新的版本。 下载zip包,并解压。
二、安装CKEditor
解压ckeditor_4.11.1_standard.zip,得到ckeditor目录,将ckeditor整个目录拷贝到WebRoot下。
三、编辑ckeditorDemo.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
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>ckeditor 的使用</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">
-->
<!-- 引入ckeditor组件 -->
<script src="${pageContext.request.contextPath }/ckeditor/ckeditor.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath }/ckeditor/samples/css/sample.css">
</head>
<body>
<form name="xiaohua" action="${pageContext.request.contextPath }/index" method="post">
评论区:<textArea class="ckeditor" rows="20" cols="30" name="content"></textArea>
<br>
</form>
</body>
</html>
需要注意三个地方:
四、打开浏览器查看效果
输入:http://localhost:8080/xiaohua/ckeditorDemo.jsp
至此,就可以使用该组件,带来的非凡体验了。