Rich-Text Editing with CKEditor

For the description field of the contact information, we use the Spring MVC <form:textarea> tag to support multiline input. Suppose we want to enable rich-text editing, which is a common requirement for long text inputs such as user comments.

To support this feature, we will use the rich-text component library CKEditor (http://ckeditor.com), which is a common rich-text JavaScript component, with integration with jQuery UI. The files are in the folder /src/main/webapp/ckeditor of the sample source code.

First we need to include the required JavaScript files into the template page (default.jspx). Listing 16-43 shows the code snippet you need to add to the page.

Listing 16-43. Add CKEditor to Page Template

<html ...

Get Pro Spring,Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.