jsp页面struts2标签展示clob类型的数据

直接从数据库中查出来的数据,是clob类型的在前端页面展示的时候是这样:


后来找到了一个方法,在action中添加一个方法,解析转换clob数据的方法

public String getClob(Clob c){
        Reader reader;
        StringBuffer sb = new StringBuffer();
        try {
            reader = c.getCharacterStream();
            BufferedReader br = new BufferedReader(reader);
            String temp = null;
            while ((temp=br.readLine()) != null) {
                sb.append(temp);
            }
        } catch (Exception e) {

        }
        return sb.toString();
    }

然后在前端这样显示:

 <s:property value="%{getClob(safetyResultIndexAssessEventList[#status.index][4])}" />

原文链接:https://kingxss.iteye.com/blog/1562424

原文地址:https://www.cnblogs.com/anningkang/p/10517392.html