日期:2014-05-16  浏览次数:55325 次

Jsp使用FCKEditor的一个例子
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%>  
   
 <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>  
 <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>  
<%@taglib uri="/WEB-INF/FCKeditor.tld" prefix="fck"%>  
  
 <%@ page import="java.util.*" %>  
 <%@ page import="org.zcinfomanage.common.ZCStaticData" %>  
 <%@ page import="org.zcinfomanage.column.dao.SiteColumnDAOImpl" %>  
<%@ page import="org.zcinfomanage.pagemanage.po.SiteColumn" %>     
<%String appContext = request.getContextPath(); %>  
<html>  
     <head><title>Test</title>  
         <script type="text/javascript">  
             function GetInnerHTML(){  
                 // Get the editor instance that we want to interact with.  
                 var oEditor = FCKeditorAPI.GetInstance('testfck');  
                 alert( oEditor.EditorDocument.body.innerHTML ) ;  
            }  
         </script>  
     </head>  
       
     <link href="css.css" rel="stylesheet" type="text/css" />  
  <body>  
    
   
 <FORM name="webPageForm" action="<%=appContext %>/webPageManage.do?method=addWebPage" method="post">  
       
    
  <table width="97%" border="0" cellspacing="1" cellpadding="2" class="borde2">  
     <tr>  
       <td height="40" background="UserFiles/Image/bg_table.jpg" bgcolor="#CBE9F9" class="jianju5 jianju4 fontBlueno">  
         <html:messages id="message" message="true">  
                 <font color="#ff0000">  
                     <LI>  
                         <bean:write name="message"/>  
                     </LI>  
                 </font>  
         </html:messages>    
       </td>  
     </tr>  
   </table>  
  <table width="97%" cellpadding="2" cellspacing="1">  
     <tr>  
         <td height="40" bgcolor="#FFFFCC" class="w">&nbsp;&nbsp;&nbsp;&nbsp;栏目名称:  
             <select name="siteColumnID">  
                 <OPTION value="0" >请选择栏目</OPTION>             
             <%  
                 List siteColumnList = ZCStaticData.getSiteColumnList();  
                 if(siteColumnList == null || siteColumnList.size() == 0){  
                     siteColumnList = new SiteColumnDAOImpl().getSiteColumnList();  
                     ZCStaticData.setSiteColumnList(siteColumnList);  
                 }  
                   
                 for(Iterator it = siteColumnList.iterator(); it.hasNext();){  
                     SiteColumn siteColumn = (SiteColumn)it.next();  
             %>  
             <OPTION value=<%=siteColumn.getId()%> >  
                 <%=siteColumn.getColumnName()%>  
             </OPTION>  
             <%  
                 }  
             %>  
       </select>     </td>  
     </tr>  
       
     <tr>  
         <td height="40" bgcolor="#FFFFCC" class="w">  
             &nbsp;&nbsp;&nbsp;&nbsp;生成的Html文件名称:&nbsp;  
             <input name="fileName" type="text"/>  
             &nbsp;&nbsp;[例如:cpynews11.html&nbsp;&nbsp;注意:文件名不能是中文]</td>  
     </tr>  
       
     <tr >  
         <td class="w" height="40" bgcolor="#FFFFCC">  
            &nbsp;&nbsp;&nbsp;&nbsp;文章标题:&nbsp;  
             <input name="fileTitle" type="text"/>  
             &nbsp;&nbsp;</td>  
     </tr>  
    
 <tr>  
     <td bgcolor="#FFFFCC">&nbsp;&nbsp;&nbsp;&nbsp;  
           <fck:editor id="fileContent" basePath="" height="400px" width=