DBMNG数据库管理与应用

书籍是全世界的营养品。生活里没有书籍,就好像没有阳光;智慧里没有书籍,就好像鸟儿没有翅膀。
当前位置:首页 > 经验分享 > WEB

JSP调用FCKeditor的几种方法

1. 使用FCKeditor自定义标签

<%@   page contentType="text/html;charset=UTF-8" language="java"%>

<%@   taglib uri="/WEB-INF/FCKeditor.tld " prefix="fck"%>

<html>

    <head>

        <title>Test</title>

    </head>

    <body>

    <!-- 标签调用方式 -->

        <FORM action="show.jsp">

            <fck:editor id="content" basePath="/test/fckeditor/" height="400"

                width="800" skinPath="/test/fckeditor/editor/skins/default/"

                toolbarSet="Default"

                imageBrowserURL="/test/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"

                linkBrowserURL="/test/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"

                flashBrowserURL="/test/fckeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"

                imageUploadURL="/test/fckeditor/editor/filemanager/upload/simpleuploader?Type=Image"

                linkUploadURL="/test/fckeditor/editor/filemanager/upload/simpleuploader?Type=File"

                flashUploadURL="/test/fckeditor/editor/filemanager/upload/simpleuploader?Type=Flash">

            </fck:editor>

            <input type="submit" value="提交">

        </FORM>

    </body>

</html>

2. 用Javascript脚本语言调用

<%@   page contentType="text/html;charset=UTF-8" language="java"%>

<html>

    <head>

        <title>Test</title>

        <script type="text/javascript" src="/test/fckeditor/fckeditor.js"></script>

    </head>

    <body>

        <form action="show.jsp" method="get">

            <table border="0" width="700">

                <tr>

                    <td>

                        <textarea id="content" name="content"

                            style="WIDTH: 100%; HEIGHT: 400px">input</textarea>

                        <script type="text/javascript">

                            var oFCKeditor = new FCKeditor('content') ;

                            oFCKeditor.BasePath = "/test/fckeditor/" ;

                            oFCKeditor.Height = 400;

                            oFCKeditor.ToolbarSet = "Default" ;

                            oFCKeditor.ReplaceTextarea();

                        </script>

                        <input type="submit" value="Submit">

                    </td>

                </tr>

            </table>

        </form>

    </body>

</html>

3. FCKeditor API 调用

<%@ page contentType="text/html;charset=UTF-8" language="java"%>

<%@ page language="java" import="com.fredck.FCKeditor.*" %>

<html>

    <head>

        <title>Test</title>

    </head>

    <body>

        <form action="show.jsp" method="post">

        <%

        FCKeditor oFCKeditor ;

        oFCKeditor = new FCKeditor( request, "content" ) ;

        oFCKeditor.setBasePath( "/test/fckeditor/" ) ;

        oFCKeditor.setValue( "input" );

        oFCKeditor.setWidth("800");

        out.println(oFCKeditor.create()) ;

        %>

        <br>

        <input type="submit" value="Submit">

        </form>

    </body>

</html>

测试页面:show.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

    <title>My JSP 'test.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">

    <meta http-equiv="cache-control" content="no-cache">

    <meta http-equiv="expires" content="0">   

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

    <meta http-equiv="description" content="This is my page">

    <!--

    <link rel="stylesheet" type="text/css" href="styles.css">

    -->

</head>

<body>

     <%=new String(request.getParameter("content").getBytes("iso-8859-1"),"UTF-8")%>

</body>

</html>

本站文章内容,部分来自于互联网,若侵犯了您的权益,请致邮件chuanghui423#sohu.com(请将#换为@)联系,我们会尽快核实后删除。
Copyright © 2006-2023 DBMNG.COM All Rights Reserved. Powered by DEVSOARTECH            豫ICP备11002312号-2

豫公网安备 41010502002439号