bhallarahul -4 Light Poster

Hi
these day i am trying learning ckeditor so i used CKEditor jar available for the java developer
when i run given code on tomcat server this ode will not give anything please tell me

    <ckeditor:replace replace="editor1" basePath="/ckeditor/" config="<%= ConfigurationHelper.createConfig() %>"   events="<%= ConfigurationHelper.createEventHandlers() %>" />  

what is wrong or it works ok
whole code is mention on given link

/**
 * 
 */
package testCK;
import java.util.ArrayList;
import java.util.List;

import com.ckeditor.CKEditorConfig;
import com.ckeditor.EventHandler;
import com.ckeditor.GlobalEventHandler;

/**
 * @author rahulbhalla
 *
 */
public class ConfigurationHelper {




        public static CKEditorConfig createConfig() {
            CKEditorConfig config = new CKEditorConfig();
            List<List<String>> list = new ArrayList<List<String>>();
            List<String> subList = new ArrayList<String>();
            subList.add("Source");
            subList.add("-");
            subList.add("Bold");
            subList.add("Italic");
            list.add(subList);
            config.addConfigValue("toolbar", list);
            config.addConfigValue("width","500");
    //      System.out.println("print");
            return config;
        }

        public static EventHandler createEventHandlers() {
            EventHandler handler = new EventHandler();
            handler.addEventHandler("instanceReady","function (ev) { alert(\"Loaded: \" + ev.editor.name); }");
            return handler;
        }

        public static GlobalEventHandler createGlobalEventHandlers() {
            GlobalEventHandler handler = new GlobalEventHandler();
            handler.addEventHandler("dialogDefinition","function (ev) {  alert(\"Loading dialog window: \" + ev.data.name); }");
            return handler;
        }

}




<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor"%>
<%@ page import="testCK.ConfigurationHelper" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
    <form action="sample_posteddata.jsp" method="get">
        <p>
            <label for="editor1">Editor 1:</label>
            <textarea cols="80" id="editor1" name="editor1" rows="10"></textarea>
        </p>
        <p>
            <input type="submit" value="Submit" />
        </p>
    </form>
    <ckeditor:replace replace="editor1" basePath="/ckeditor/" />
    <%/*    replace – points to the name or ID of the HTML textarea element that is to be replaced with a CKEditor instance.
            basePath – contains the path to the main CKEditor directory. 
    */ %>

    <ckeditor:replace replace="editor1" basePath="/ckeditor/" config="<%= ConfigurationHelper.createConfig() %>"   events="<%= ConfigurationHelper.createEventHandlers() %>" />  

</body>
</html>

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.