Integrating CKFinder

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

m (updated taglib)
Line 38: Line 38:
 
* In order to use the tag on the JSP page you should import the tag library by using the following directive:
 
* In order to use the tag on the JSP page you should import the tag library by using the following directive:
 
<source lang="java">
 
<source lang="java">
<%@ taglib uri='../../WEB-INF/ckfinder.tld' prefix='ck' %>
+
<%@ taglib uri="http://ckfinder.com" prefix="ckfinder" %>
 
</source>
 
</source>
  
 
You can now use the CKFinder tag on your JSP page in the following way:
 
You can now use the CKFinder tag on your JSP page in the following way:
 
<source lang="java">
 
<source lang="java">
<ck:ckfinder basePath="/CKFinderJava-1.0/ckfinder/" />
+
<ckfinder:ckfinder basePath="/CKFinderJava-2.0/ckfinder/" />
 
</source>
 
</source>
  
Line 49: Line 49:
  
 
<source lang="java">
 
<source lang="java">
<ck:ckfinder basePath="/CKFinderJava-1.0/ckfinder/" width="700" height="500" />
+
<ckfinder:ckfinder basePath="/CKFinderJava-1.0/ckfinder/" width="700" height="500" />
 
</source>
 
</source>
  

Revision as of 21:14, 1 May 2011

This article describes various ways of integrating CKFinder for Java with your page.

Integrating CKFinder with your Application

After you download the CKFinder for Java .war file, follow the steps below to integrate it with your application:

  • Unpack CKFinder for Java.
  • Copy the ckfinder folder to your application.
  • Copy the CKFinder config.xml file from its WEB-INF folder into the WEB-INF folder of your application.
  • Copy the contents of the CKFinder WEB-INF/lib folder into the WEB-INF/lib folder of your application.
  • Copy the ConnectorServlet settings from the CKFinder web.xml file to the web.xml file of your application.
<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>
	<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
	<servlet-name>ConnectorServlet</servlet-name>
	<url-pattern>
		/ckfinder/core/connector/java/connector.java
	</url-pattern>
</servlet-mapping>
  • Just like in the sample application, by default CKFinder is disabled due to security reasons. To turn it on, change the <enabled> element value in the config.xml file to true. Note that it is recommended to use a more fine-grained authentication method by overriding the checkAuthentication method.
<enabled>true</enabled>
  • Similarily, some further adjustments of the config.xml file might be needed, like baseUrl and baseDir paths, for example.

Installing CKFinder as a JSP Page Tag

In order to install CKFinder as a tag inside a .jsp page, follow the steps outlined below:

  • Install CKFinder as described in the section above.
  • In order to use the tag on the JSP page you should import the tag library by using the following directive:
<%@ taglib uri="http://ckfinder.com" prefix="ckfinder" %>

You can now use the CKFinder tag on your JSP page in the following way:

<ckfinder:ckfinder basePath="/CKFinderJava-2.0/ckfinder/" />

The only required attribute is the basePath that specifies the path to the CKFinder folder. Numerous optional attributes are also available and can be used to customize CKFinder to your needs, like in the example below:

<ckfinder:ckfinder basePath="/CKFinderJava-1.0/ckfinder/" width="700" height="500" />

This code creates a CKFinder instance with a width of 700 pixels and height of 500 pixels.

Extending Configuration

The MyConfiguration class lets you change the base CKFinder configuration, or, in other words, change the settings from the XML file at the Java class level. To read more about extending your CKFinder configuration, refer to the Extending CKFinder Configuration article.