Fckedit 2.6アクセスoralceのclobタイプ


元々はstream流でclobタイプのデータをudateページに読みたいですが、原因が分かりません。文字化けです。
でも大丈夫です。clobタイプはget SubString方法があります。
モデル
clobタイプの変換後に貯蔵するためのString属性を作成します。
package com.zk.model.business;

import java.sql.Clob;
import java.sql.Date;

import oracle.sql.CLOB;

/**
 * Issueinfo entity. @author MyEclipse Persistence Tools
 */

public class Issueinfo implements java.io.Serializable {

	// Fields

	private String recid;
	private String title;
	private Date issuetim;
	private String infosort;
	private String worker;
	private Clob content;
	private String strContent;

	public String getStrContent() {
		return strContent;
	}

	public void setStrContent(String strContent) {
		this.strContent = strContent;
	}

	/** default constructor */
	public Issueinfo() {
	}

	/** minimal constructor */
	public Issueinfo(String recid) {
		this.recid = recid;
	}

	/** full constructor */
	public Issueinfo(String recid, String title, Date issuetim,
			String infosort, String worker, Clob content) {
		this.recid = recid;
		this.title = title;
		this.issuetim = issuetim;
		this.infosort = infosort;
		this.worker = worker;
		this.content = content;
	}

	// Property accessors

	public String getRecid() {
		return this.recid;
	}

	public void setRecid(String recid) {
		this.recid = recid;
	}

	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Date getIssuetim() {
		return this.issuetim;
	}

	public void setIssuetim(Date issuetim) {
		this.issuetim = issuetim;
	}

	public String getInfosort() {
		return this.infosort;
	}

	public void setInfosort(String infosort) {
		this.infosort = infosort;
	}

	public String getWorker() {
		return this.worker;
	}

	public void setWorker(String worker) {
		this.worker = worker;
	}

	public Clob getContent() {
		return this.content;
	}

	public void setContent(Clob content) {
		this.content = content;
	}

}
 model.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- 
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    <class name="com.zk.model.business.Issueinfo" table="ISSUEINFO" schema="PAWNSYS">
        <id name="recid" type="java.lang.String">
            <column name="RECID" length="12" />
            <generator class="assigned"></generator>
        </id>
        <property name="title" type="java.lang.String">
            <column name="TITLE" length="100" />
        </property>
        <property name="issuetim" type="java.sql.Date">
            <column name="ISSUETIM" length="7" />
        </property>
        <property name="infosort" type="java.lang.String">
            <column name="INFOSORT" length="1" />
        </property>
        <property name="worker" type="java.lang.String">
            <column name="WORKER" length="30" />
        </property>
        <property name="content" type="java.sql.Clob">
            <column name="CONTENT"/>
        </property>
    </class>
</hibernate-mapping>
  
Dao
対象書を入庫する
public void addObj(Issueinfo obj) throws LException {
	try {
			Session session = this.getSession();
			Transaction tran = session.beginTransaction();
			obj.setContent(Hibernate.createClob(" "));//   ,         ,       Clob  
			session.save(obj);
			session.flush();//     
			session.refresh(obj, LockMode.UPGRADE);
			SerializableClob sc = (SerializableClob) obj.getContent();// kybasicInfo.getInfoContent() Clob   
			Clob wrapclob = sc.getWrappedClob();//    Clob java.sql.Clob
			CLOB clob = (CLOB) wrapclob;//    CLOB oracle.sql.CLOB
			Writer writer = clob.getCharacterOutputStream();
			writer.write(obj.getStrContent());// kybasicInfo.getInfoContentToString() String   , action        ,            CLOB   
			writer.close();
			session.save(obj);
			tran.commit();
		} catch (RuntimeException re) {
			throw re;
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
 オブジェクトをライブラリから取り出す
 
public Issueinfo getInfo(String recid, String infosort) throws LException {
		Session session = this.getSession();
		session.beginTransaction();
		Connection con = null;
		Statement st = null;
		ResultSet rs = null;
		Issueinfo is = new Issueinfo();
		try {
			con = session.connection();
			st = con.createStatement();

			rs = st.executeQuery("select * from issueinfo where recid='"
					+ recid + "' and infosort='" + infosort + "'");
			if (rs.next()) {
				Clob content = rs.getClob("CONTENT");//  clob  
				// clob   String			
				long longLen = content.length();//  
				System.out.println(longLen);
				String rtn = content.getSubString(1L, (int) longLen);//        clob String    
				is.setRecid(rs.getString("RECID"));
				is.setIssuetim(rs.getDate("ISSUETIM"));
				is.setInfosort(rs.getString("INFOSORT"));
				is.setTitle(rs.getString("TITLE"));
				is.setWorker(rs.getString("WORKER"));
				is.setStrContent(rtn);//        
				System.out.println(rtn);
			}

		} catch (SQLException e) { // TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			if (rs != null) {
				try {
					con.close();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			if (st != null) {
				try {
					con.close();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			if (con != null) {
				try {
					con.close();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			session.close();
		}
		return is;
	}
 ビュー
ストコンテントを取り出す時に注意します。
<s:property value=“”/>デフォルトの入力はフィルタです。
escape=falseを加えて、html文字列をhtml入力に変換します。
									<FCK:editor instanceName="content" toolbarSet="My" width="660"
										height="400">

										<jsp:attribute name="value">

								
					   				<s:property value="isinfo.strContent" escape="false" />
					   				
					   	 			</jsp:attribute>

									</FCK:editor>