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)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 长丰县| 石首市| 定结县| 双牌县| 大邑县| 漾濞| 若尔盖县| 灵川县| 黎平县| 曲阳县| 东辽县| 梨树县| 民权县| 漳平市| 惠安县| 始兴县| 股票| 保定市| 黑龙江省| 泸州市| 沂南县| 土默特左旗| 临清市| 红桥区| 那曲县| 安溪县| 丰原市| 黄冈市| 建德市| 贵阳市| 巍山| 合山市| 康保县| 济宁市| 崇信县| 翁牛特旗| 贵州省| 象州县| 靖西县| 徐闻县| 吴川市|