天天看点

table框架调用js clob字段的使用

 return  "<a href='javascript:show(" + result['id'] + ")'>"+ data.substring(0,20) +"......</a>";

 try {  

        option.setcontent(utiltool.clobtostring((oracle.sql.clob)rs.getclob("content")));

       } catch (exception e) {

        e.printstacktrace();

       }

// 将字clob转成string类型 

 public static string clobtostring(clob clob) throws sqlexception, ioexception {

  string restring = ""; 

  reader is = clob.getcharacterstream();// 得到流 

  bufferedreader br = new bufferedreader(is); 

  string s = br.readline(); 

  stringbuffer sb = new stringbuffer(); 

  while (s != null) {// 执行循环将字符串全部取出付值给stringbuffer由stringbuffer转成string 

   sb.append(s); 

   s = br.readline(); 

  } 

  restring = sb.tostring(); 

  return restring; 

 }

继续阅读