2012-10-18 48 views
1

我想在我的spring mvc中使用Fckeditor。你能否提供指導或鏈接來逐步設置?FKeditor和Spring MVC Maven集成步驟

我做了下面的步驟,但是當我運行時,404找不到[/springmvc/fckeditor/editor/fckeditor.html]顯示。

你能檢查我是什麼錯,並指導我嗎?

首先,根據文檔,我在pom.xml中添加了以下代碼。

<dependency> 
    <groupId>net.fckeditor</groupId> 
    <artifactId>java-core</artifactId> 
    <version>2.6</version> 
</dependency> 

而在web.xml文件中,我添加了下面的代碼。

<servlet> 
     <servlet-name>ConnectorServlet</servlet-name> 
     <servlet-class> 
      net.fckeditor.connector.ConnectorServlet 
     </servlet-class> 
     <load-on-startup>1</load-on-startup> 
</servlet> 

<servlet-mapping> 
    <servlet-name>ConnectorServlet</servlet-name> 
    <url-pattern> 
    /resources/fckeditor/editor/filemanager/connectors/* 
    </url-pattern> 
</servlet-mapping> 

之後我下載了FCKeditor_2.6.8.zip文件並解壓到src/main/resources文件夾中。

在jsp頁面中,我添加了taglib,javascript和標記。

<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>

function FCKeditor_OnComplete(editorInstance) { 
    window.status = editorInstance.Description; 
} 
<FCK:editor instanceName="EditorDefault"> 
    <jsp:attribute name="value">This is some <strong>sample text 
     </strong>. You are using <a href="http://www.fckeditor.net"> 
     FCKeditor</a>. 
    </jsp:attribute> 
</FCK:editor> 

但FCKEDITOR仍然沒有工作。

你能指導我哪個是錯的嗎?

謝謝

回答

2

我已經使用CKEditor的,下面是configrations

<dependency> 
     <groupId>com.ckeditor</groupId> 
     <artifactId>ckeditor-java-core</artifactId> 
     <version>3.5.3</version> 
    </dependency> 

在JSP文件

<%@ taglib prefix="ckeditor" uri="http://ckeditor.com"%> 
     <script type="text/javascript" src="%=request.getContextPath()%>/common/script/ckeditor/ckeditor.js"></script> 
<form:textarea path="body" maxlength="5000" />              <ckeditor:replace replace="body" basePath="../ckeditor/" /> 

確保您還複製js文件並把它複製,並在指定它jsp

+0

謝謝Jigar Parekh。它現在按照你的指示工作。對我而言,我需要將ckeditor放置在資源文件夾中。 – user1542487

+0

很高興知道問題解決了,接受答案,這樣也可以幫助別人。 –