注册 | 登录 | 设为首页 | 加入收藏
您当前的位置:飞翔学院-IT中国 → 编程开发JSP → 文章内容

让FCKeditor在JSP和JSF项目中跑起来

作者:佚名 来源:不详 发布时间:2007-11-30 0:02:44

四、使用

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, 祝你顺利!



上一页  [1] [2] [3] 


  • 打印文档
  • 推荐好友
  • 返回顶部
  • 增大字体
  • 减少字体
关于本站 | 工作机会 | 合作网站 | 广告服务 | 市场合作| 联系我们 | 抽奖活动
版权所有: 武汉威俊科技有限公司 Copyright 2005-2007 www.ITCNW.COM All rights reserved