JBOSS 點滴

          豐豐的博客

          JAVA+ORACLE+BLOB+Mybatis

          實體類:
              private  byte[] richContent;
              
          public byte[] getRichContent() {
                  
          return richContent;
              }


              
          public void setRichContent(byte[] richContent) {
                  
          this.richContent = richContent;
              }

          Mapper.xml
              <result column="RICH_CONTENT" property="richContent" jdbcType="BLOB" typeHandler="org.apache.ibatis.type.BlobTypeHandler"/>

                <if test="richContent != null" >
                  UPDATE_DATE = #{richContent,jdbcType=BLOB},
                
          </if>
          JSP
          <td class="propname">發布內容:</td>
          <td class="propvalue" colspan="6">
          <div id="myEditor" type="text/plain" name='content' style="width: 900px;height:400px;"/>
          </td>
          CONTROL保存
              //利用content轉換為二進制,存入richcontent
          String strRich = newsBean.getContent();
          if(strRich.length()>0) {
          byte[] temp = strRich.getBytes();
          newsBean.setRichContent(temp);
          newsBean.setContent("");
          }

          CONTROL顯示:
          if(casNewsModel.getRichContent().length>0) {
          content = new String(casNewsModel.getRichContent());
          casNewsModel.setContent(content);
          }



          posted on 2018-01-22 20:34 半導體 閱讀(210) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 辽源市| 方城县| 赫章县| 苗栗县| 皮山县| 黄梅县| 府谷县| 五原县| 墨竹工卡县| 延津县| 平果县| 洛扎县| 宁蒗| 观塘区| 班戈县| 马公市| 施甸县| 宁海县| 宿州市| 渭源县| 赫章县| 昌乐县| 宾阳县| 富裕县| 曲水县| 辉南县| 昌吉市| 洪泽县| 崇左市| 太湖县| 溆浦县| 哈巴河县| 涞水县| 宁明县| 砚山县| 扎兰屯市| 民县| 来宾市| 绵阳市| 丽江市| 广东省|