jsp显示太慢,请高手帮忙,经理黑上我了;如果list有100条数据的话,页面会死了,怎么解决!!!!
<c:if test="${requestScope['wshyh'] =='Y'}">
<c:forEach items="${listyhmx}" var="yhdmx" >
<tr id="insert">
<td>
<c:if test="${yhdmx.FLAG==1}">
<input type="checkbox" onclick="bj1()" checked>
<input type="hidden" name="bj" value="1">
</c:if>
<c:if test="${yhdmx.FLAG==0}">
<input type="checkbox" onclick="bj1()">
<input type="hidden" name="bj" value="0">
</c:if>
</td>
<td> <input type="text" id="hh" name="hh" size="6" value="${yhdmx.SPBH}" >
</td>
<td> <input type="text" id="hwmc" name="hwmc" size="13" value="${yhdmx.PM}" readonly="readonly"></td>
<td> <input type="text" id="gg" name="gg" size="7" value="${yhdmx.GG}" readonly="readonly"></td>
<td> <input type="text" id="dw" name="dw" size="4" value="${yhdmx.JLDW}" readonly="readonly"></td>
<td> <input type="text" id="lsj" name="lsj" size="7" class="td_number" value="${yhdmx.LSJ}" readonly="readonly"></td>
<td> <input type="text" id="sccj" name="sccj" size="14" value="${yhdmx.CJMC}" readonly="readonly"></td>
<td> <input type="text" id="gysbh" name="gysbh" size="7" value="${yhdmx.GYSBH}" onkeyup="xzgys()">
</td>
<td> <input type="text" id="gysmc" name="gysmc" size="14" value="${yhdmx.GYSMC}" readonly="readonly"></td>
<td> <input type="text" id="cl" name="cl" size="4" class="td_number" value="${yhdmx.DCL}" readonly="readonly"></td>
<td> <input type="text" id="sl" name="sl" size="4" class="td_number" value="${yhdmx.YHSL}" onblur="common2()"></td>
<td>
<input type="text" id="jhj" name="jhj" size="5" class="td_number" value="${yhdmx.JHJ}">
</td>
<td>
<input type="text" id="fdkc" name="fdkc" size="8" class="td_number" readonly="readonly" value="${yhdmx.FGSKC}" onmouseover="richContext(); return false;" onmouseout="hide()">
<input type="hidden" id="fdkcl" name="fdkcl" value="${yhdmx.FGSKCL}"></input>
</td>
<td>
<input type="text" id="bz" name="beizhu" size="8" value="${yhdmx.BZ}">
</td>
<td> <input type="button" class="td_button" name="zengjia" value="增加"
onclick="insertrow()">
<input type="button" class="td_button" name="shanchu" value="删除"
onclick="deleteRow(getIndex())">
</td>
</tr>
</c:forEach>
</c:if>
[解决办法]
System.out.println(sql);
dbc=new DBconnection();
List list = new ArrayList();
-------------------------------
1,这段代码有问题,dbc 的声明在哪里?严禁把 Connection, PreparedStatement, ResultSet 等数据库连接对象设成成员变量。
2,DBconnection 中的实现也不知道是怎么样的,建议采用 c3p0 连接直接获得 Connection,再一个一个地老老实实地关闭,如下:
import java.beans.PropertyVetoException;import java.sql.Connection;import java.sql.DatabaseMetaData;import java.sql.SQLException;import org.apache.log4j.Logger;import com.mchange.v2.c3p0.ComboPooledDataSource;public class ConnectionManager { private final static Logger LOG = Logger.getLogger(ConnectionManager.class); private static ComboPooledDataSource ds = new ComboPooledDataSource(); private ConnectionManager() { } static { try { if(LOG.isDebugEnabled()) { LOG.debug("正在初始化数据连接池"); } Config config = Config.getInstance(); ds.setDriverClass(config.getJdbcDriver()); ds.setJdbcUrl(config.getJdbcUrl()); ds.setUser(config.getDatabaseUsername()); ds.setPassword(config.getDatabasePassword()); ds.setMaxPoolSize(config.getDatabasePoolMaxSize()); ds.setMinPoolSize(config.getDatabasePoolMinSize()); if(LOG.isDebugEnabled()) { LOG.debug("数据连接池初始化完成" + ", 最大可用连接数:" +ds.getMaxPoolSize() + ", 最小连接数:" + ds.getMinPoolSize()); } } catch (PropertyVetoException e) { LOG.error("连接池初始化失败,原因:" + e.getMessage()); e.printStackTrace(); } } public static Connection getConnection() throws SQLException { return ds.getConnection(); }}