zoukankan      html  css  js  c++  java
  • Java Web开发之Servlet获取ckeditor内容

    js:

    <!-- ckeditor插件 -->
        <script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>
    window.onload = function(){
        //将textarea替换ckeditor
        var yjfx = null;//研究方向
        var jj = null;//简介
        jj = CKEDITOR.replace('jj');
        yjfx = CKEDITOR.replace('yjfx'); //''内为textarea元素的name属性值,而非id属性值
        //给ckeditor赋值
        var tyjfxcontent = $('#yjfxhd').val();
        var jjcontent = $('#jjhd').val();
        CKEDITOR.instances.yjfx.setData(tyjfxcontent);
        CKEDITOR.instances.jj.setData(jjcontent);
    }

    hmtl:

    <div class="form-group">
                              <label>研究方向</label>
                              <textarea value="" name="yjfx" rows="5" class="form-control"></textarea>
                              <input id="yjfxhd" value="${basicInformation.research }" type="hidden"/>
                            </div>
                            <div class="form-group">
                              <label>简介</label>
                              <textarea value="" name="jj" rows="5" class="form-control"></textarea>
                              <input id="jjhd" value="${basicInformation.info }" type="hidden"/>
                            </div>

    servlet:

    //获得研究方向
            String yjfx = request.getParameter("yjfx").toString();//注意""内是textarea的name
  • 相关阅读:
    cron表达式详解
    C# Quartz 调度任务辅助类
    SQLserver查询用逗号隔开的字段中是否包含另一个字段的值
    c# 将字符串转换为逻辑表达式(字符串转换布尔)
    铺砖块
    字符串涂漆
    快餐店
    乘号加号
    传纸条(lgP1006)
    小明的喷漆计划
  • 原文地址:https://www.cnblogs.com/landiljy/p/5950119.html
Copyright © 2011-2022 走看看