The main object of the editor is codes.thischwa.ckeditor.CKEditor. Let's have a look at a minimal code snippet to see how it works:

  CKEditor editor = new CKEditor(request, "fieldName");
  editor.setValue("This is some <strong>sample text</strong>."); <!-- initial value -->

That's all!


It's really important to understand that the properties are divided into two parts:

  • Basic properties for CKEditor.java itself:
    • default.encoding: The general character encoding. The default is UTF-8. Should be untouched!
    • ckeditor.basePath: The directory of the editor relative to the context root. The default is /ckeditor.
  • All available configuration properties for the CKEditor (see). These properties will be passing-thru the CKEditor.
    This can keep your frontend-code clean!

The handling of these two types of properties is the same.

Types of Configuration Setting

The handling of properties in CKEditor and CKEditor.java are based on the same principle, - 'convention over configuration'. This means, all properties have defaults.

CKEditor.Java supports two levels, where the properties can be overwritten:

  • Global: The overwritten properties are valid for the entire web application. All changes have an effect on all instances of the editor!
  • Singular: The overwritten properties have an effect on only one editor instance.

There is no requirement to use only these types of configuration. Just keep the loading order in mind:

  1. loading of the default properties
  2. (if exists) loading of the global properties (overwrites the defaults)
  3. (if exists) loading of the singular properties (overwrites the default and global properties)

Starting from here the Configuration Loading Order of the CKEditor is valid.