在struts2中集成fckedit时,主要注意使用<s:property>标签的时候需要带escape="false"属性,这样才能在fckedit中显示原始的格式:
<%@page contentType="text/html;charset=UTF-8"%>
<%@ page import="org.openjweb.core.util.DropdownListBoxUtil"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib uri="http://fckeditor.net/tags-fckeditor" prefix="FCK" %>
<sec:authorize ifNotGranted="AUTH_TEST">
<%
//response.sendRedirect(request.getContextPath()+"/accessDenied.jsp");
%>
</sec:authorize>
<html>
<head>
<title>hr_resume</title>
<script language="JavaScript">
function editInfo()
{
var o = FCKeditorAPI.GetInstance('content') ;
var c = o.GetXHTML();
alert(c);
document.forms[0].elements['editEntity.empResumeText'].value = c;
//var body = document.forms[0].elements['editEntity.empResumeText'];
//document.forms[0].operate.value="editInfo";
document.forms[0].submit();
}
function getDictName(dbServiceName,entityClassName,codeFieldName,codeFieldValue,nameField,parmType,obj)
{
StringUtil.getDictNameByCode(dbServiceName,entityClassName,codeFieldName,codeFieldValue,nameField,parmType,{callback:function(data){setDictName(data,obj)}});
}
function setDictName(data,obj)
{
obj.value=data;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<s:head theme="ajax"/>
</head>
<script type='text/javascript' src='<%=request.getContextPath()%>/js/util.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/js/engine.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/StringUtil.js'></script>
<!--
<script language="javascript" src="<%=request.getContextPath() %>/js/calendar.js"></script>
<script language="javascript" src="<%=request.getContextPath() %>/js/doc_register.js"></script>
<script language="javascript" src="<%=request.getContextPath() %>/js/prototype.js"></script>
-->
<script language="javascript" type="text/javascript" src="<%=request.getContextPath()%>/My97DatePicker/WdatePicker.js"></script>
<link href="<%=request.getContextPath() %>/css/body.css" rel="stylesheet" type="text/css">
<div class="body">
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td height="12"><span class="STYLE1">
hr_resume</span></td>
</tr>
<tr>
<td height="30" style="border:solid 1px #CCCCCC; padding-left:12px">
<span class="STYLE4">
<a href="doctor_list.jsp" class="no_link">hr_resume</a> > hr_resume
</span>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
</table>
<s:form name="editForm" method="post" action="listHrResume!save.action">
<table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
<s:textfield label="应聘人员姓名" name="editEntity.empName" />
<s:select label="学历" name="editEntity.empXueli" list="#request['map'].empXueli" listKey="code" listValue="name" emptyOption="true" />
<tr align="center"> <td width="10%" align="right">出生日期</td><td align="left"><input type="text" name="editEntity.empBirthDate" class="wDate" onfocus="new WdatePicker(this)" /></td></tr> <s:textarea label="自我评价" name="editEntity.empDesc" />
<tr align="center"><td class="tdLabel">ewwe</td><td align="left"><input type="hidden" name="editEntity.empTest1"/><input type="text" name="nameField" /><image src="<%=request.getContextPath()%>/images/icon.gif" onclick="window.open('<%=request.getContextPath()%>/hr/popupHrResume.action?codeField=editEntity.empTest1&nameField=nameField');"/></td></tr>
<script language="JavaScript" type="text/javascript">
getDictName("IDBSupportService3","org.openjweb.core.entity.HrResume","pkId","<s:property value="editEntity.empTest1"/>","objName","String",document.getElementsByName("nameField")[0]);</script><s:textfield label=" ceshi2" name="editEntity.empTest2" />
<s:textfield label="姓名" name="editEntity.objName" />
<s:hidden name="editEntity.flowTitle"/>
<s:hidden name="editEntity.rowId"/>
<s:hidden name="editEntity.createDt"/>
<s:hidden name="editEntity.createUid"/>
<s:hidden name="editEntity.updateDt"/>
<s:hidden name="editEntity.updateUid"/>
<s:hidden name="editEntity.flowStatus"/>
<s:hidden name="editEntity.pkId"/>
<s:hidden name="editEntity.sortNo"/>
<s:hidden name="editEntity.dataFlg"/>
<tr class="add_head">
<td height="235">
<FCK:editor id="content" basePath="/crm/szeditor/" width="1000%" height="300"
imageBrowserURL="/system/szeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="/system/szeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
flashBrowserURL="/system/szeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="/system/szeditor/editor/filemanager/upload/simpleuploader?Type=Image"
linkUploadURL="/system/szeditor/editor/filemanager/upload/simpleuploader?Type=File"
flashUploadURL="/system/szeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
<s:property value="editEntity.empResumeText" escape="false" />
</FCK:editor>
<s:hidden name="editEntity.empResumeText" />
</td>
</tr>
<s:hidden name="selId"/>
<s:actionmessage/>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style=" border:1px #CCCCCC solid; border-top:0px;">
<tr align="center" class="zhengwen" bgcolor="#F8FBFB">
<td colspan="3" align="center">
<input type="button" name="register" value="保存" class="button" onClick="editInfo()">
<input type="button" onClick="opener.window.location.reload();window.close();" class="button" value="关闭窗口">
</td>
</tr>
</table>
</s:form>
</div>
</html>