|
|
四、使用
4.1 使用javascipt替换textarea方法
/////////////////////////////////////////////////////
<script type="text/javascript" src="<c:url value="/FCKeditor/fckeditor.js"/>"></script>
<h:form id="newsadd">
<h:outputText value="Title:"/>
<h:inputText value="#{newsAddForm.title }"/>
<br/>
<h:outputText value="Content:"/>
<h:inputTextarea id="content" value="#{newsAddForm.content }" cols="80" rows="5"/>
<br/>
<h:commandButton value="Submit" action="#{newsAddForm.submit }"/>
<script type="text/javascript">
var oFCKeditor = new FCKeditor('newsadd:content') ; //这里设置textarea的id或name
oFCKeditor.BasePath = '<c:url value="/FCKeditor/"/>' ;
oFCKeditor.Height = "80%"; //这里设置高度
oFCKeditor.ToolbarSet = "Default" ;
oFCKeditor.ReplaceTextarea();
</script>
</h:form>
/////////////////////////////////////////////////////
4.2 使用jsf标签
/////////////////////////////////////////////////////
<%@ taglib uri="http://www.fck-faces.org/fck-faces" prefix="fck"%>
<h:form id="form1">
<fck:editor toolbarSet="Default" value="#{fckText.text}" width="80%" height="80%" id="myComponentId" cols="80" rows="18"/>
<h:commandButton action="#{fckText.print}"/>
</h:form>
/////////////////////////////////////////////////////
五、严重注意事项
我的web.xml配置了JSF拦截*.html文件,现在FCKeditor使用了大量的*.html,结果导致
它们都被Faces Servlet拦截了,一个页面都出不来,怎么办呢?
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
想来想去,没有什么好办法,唯有把原来项目中使用*.html的全部改为*.jsf,真惨!
不知道你有什么好方法呢?还请发表评论或者来信告知! samland@21cn.com
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
OK, 祝你顺利!


添加到百度搜藏