CKEditor Environment, please refer to the introduction of CKEditor3.6 tutorial in JSP
JSP pages submit form data using Rich Text control CKEditor
JSP pages use Rich Text controls CKEditor custom styles
JSP uses CKEditor and ckfinder to realize rich text and upload function source download
First, download
CKEditor Download address is: Http://ckeditor.com/download
Ckfinder Download address is: Http://ckfinder.com/download
Second, unzip your downloaded ckeditor-java-x.x.zip and ckfinder_java_x.x.zip of these 2 compressed files
The CKEditor folder under the Ckeditor-java-x.x.zip directory and the ckfinder_java_x.x\ckfinder\_sources\ckfinderfor under the Ckfinder_java_x.x.zip directory _java\webapp\src\main\webapp\ckfinder copied to your project's Webroot root directory.
Copy all the packages in the Lib directory of the 2 files you downloaded to the Lib under your project
Iv. ckfinder_java_x.x\ckfinder\_sources\ckfinderfor java\webapp\src\main\webapp\ under the ckfinder_java_x.x catalogue The Config.xml files in the Web-inf directory are copied to the Webroot\web-inf directory of your project, and then Config.xml:
Change the <enabled>false</enabled> in the first row to <enabled>true</enabled>;
The third line of the <baseURL>/code/upload/</baseURL>
(Here for your upload file path, modified to your root directory where you want to store) here I use the absolute path, where code is the name of the project, if not so write, upload the image to get the path will be/upload/directory, resulting in the normal display of pictures.
v. Modify the Web.xml in the project
<?xml version= "1.0" encoding= "UTF-8"?> <web-app version= "2.5" xmlns= "Http://java.sun.com/xml/ns/javaee" Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee http ://java.sun.com/xml/ns/javaee/web-app_2_5.xsd "> <servlet> <servlet-name>connectorservlet</ Servlet-name> <servlet-class>com.ckfinder.connector.ConnectorServlet</servlet-class> < Init-param> <param-name>XMLConfig</param-name> <param-value>/web-inf/config.xml</ param-value> </init-param> <init-param> <param-name>debug</param-name> <param-valu e>false</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet > <servlet-mapping> <servlet-name>ConnectorServlet</servlet-name> <url-pattern>/ckfind Er/core/connector/java/connector.java </url-pattern> </servlet-mapping> <session-config> <session-timeout>10</session-timeout> </session-config> < welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app >
Six, after the configuration is complete, call taglib in the JSP page--index.jsp
<%@ page language= "java" import= "java.util.*" pageencoding= "GBK"%> <%@ taglib uri= "http://ckeditor.com" prefix= "CKEditor"%> <%@ taglib uri= "http://ckfinder.com" prefix= "Ckfinder"%> DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
Seven, the Test effect chart
Eight, accept the page dotest.jsp code and display effect
<%@ page language= "java" import= "java.util.*" pageencoding= "GBK"%> <!
DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >