freemarker中使用标签方式调用FCKEditor

首先在文档头部声明引入标签:

<#assign fck=JspTaglibs["http://java.fckeditor.net"]/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


调用:

首先判断要显示的值是否为空,为空则不取值,不为空则用${ }取值,否则会出错。

<@s.if test="templateData==null || templateData.getVProductDescrip()==null">
		        		<@fck.editor instanceName="EditorDefault" inputName="templateData.VProductDescrip" height="400px"
							width="680"></@fck.editor>
					</@s.if>				
					<@s.else>
						<@fck.editor instanceName="EditorDefault" inputName="templateData.VProductDescrip" height="400px"
							width="680" value="${templateData.VProductDescrip} "></@fck.editor>
					/@s.else

 

instanceName 是FCKEditor类的一个实例名,可任意指定;

inputName  是将要生成的input标签名,必须与action中要接受参数的对象属性名相一致。

action中应包含templateData对象,并且templateData对象有setVProductDescrip方法

value 为编辑器内容

经过编辑器存入数据库的内容中包含html标记,在其他标签中显示时应该设置escape属性。

(property标签中的 escape:指定是否escapeHTML代码

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章