导入本地包

在AppFuse2.0(JSF)中集成FCKeditor


fck-faces项目把MyFace和FCKeditor无缝己集成起来,使用起来很简单,真是太棒了!
首先下载 fck-faces-1.7.26,这个版本已经把FCKeditor2.3.1一起打包了,不用再去下载FCKeditor了。

对于AppFuse2.0,所有的依赖库都是用maven2管理,但是maven官方库里并没有对fck-faces支持,没办法只能自己指定本地的jar资源(maven声明不推荐这么使用,希望将来fck-faces也加入到maven中来)。在pom.xml加入下列配置:

        <!-- Dependencies with local JARs -->
        <dependency>
            <groupId>org.fckfaces</groupId>
            <artifactId>fck-faces</artifactId>
            <version>1.7.26</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/fck-faces-1.7.26.jar</systemPath>
        </dependency>

注意:<systemPath>需要指定你的fck-faces-1.7.26.jar在哪里,为了让appfuse在打包部署的时候能够加入fck-fackes,建议把jar文件放在/src/main/webapp/WEB-INF/lib/下,这样在打包的时候就没问题了。

接下来配置web.xml,按照官方的说明添加以下内容即可:
    <servlet>
        <servlet-name>FCK Faces Servlet</servlet-name>
        <servlet-class>org.fckfaces.util.Servlet</servlet-class>
        <load-on-startup>3</load-on-startup>
    </servlet>
   
    <servlet-mapping>
        <servlet-name>FCK Faces Servlet</servlet-name>
        <url-pattern>/fckfaces/*</url-pattern>
    </servlet-mapping>

OK!下面就可以在页面上使用FCKeditor了,appfuse2使用嗯facelet,所以在页面上加入xmlname space xmlns:fck="http://www.fck-faces.org/fck-faces"


fck-faces标签的使用:
Default:
<fck:editor value="#{MyBackingBean.editorText}" />
Custom:
<fck:editor toolbarSet="Basic" value="#{MyBackingBean.editorText}" />
Full:
<fck:editor toolbarSet="Basic" height="500" width="100%" value="#{MyBackingBean.editorText}" />

你可能感兴趣的:(maven,servlet,JSF,fckeditor,Appfuse)