jsp页面上有三个循环,到现在一个小时了,也没有打开Jsp页面,这是怎么回事啊?有没有好的办法解决呢?
因为写了俩个sql,就会有俩个list。。。。
你这个截图是哪里的?还有三个循环?你说的是javascript的?还是后台的java代码?描述清楚才能更好地判断问题、
这是jsp显示页面,执行过程中,是java代码
for(int k0 = 0;k0<schema.size();k0++){
int k1;
int k;
%>
<tr>
<%
for(k = 0;k<=k0;k++){
web_R_RepolicyMainInfoDto = (Web_R_RepolicyMainInfoDto)schema.get(k) ;
String policyNo = web_R_RepolicyMainInfoDto.getPolicyNo();
double dangerNo = web_R_RepolicyMainInfoDto.getDangerNo();
String comCode = web_R_RepolicyMainInfoDto.getComCName();
String riskName = web_R_RepolicyMainInfoDto.getRiskName();
String insuredName = web_R_RepolicyMainInfoDto.getInsuredName();
String occupancyName = web_R_RepolicyMainInfoDto.getOccupancyName();
String startDate = String.valueOf(web_R_RepolicyMainInfoDto.getStartDate());
String endDate = String.valueOf(web_R_RepolicyMainInfoDto.getEndDate());
String currency = web_R_RepolicyMainInfoDto.getCurrencyName();
double baseAmount = web_R_RepolicyMainInfoDto.getBaseAmount();
double basePremium = web_R_RepolicyMainInfoDto.getBasePremium();
double allTotReamount=web_R_RepolicyMainInfoDto.getAllTotReamount();//合约总分出保额 2013-9-12 WPP
totBaseAmount += baseAmount;
totBasePremium += basePremium;
totallTotReamount +=allTotReamount;//2013-9-12 WPP
%>
<td align="left" nowrap><%= k+1%></td>
<td align="left" nowrap><%= policyNo %>‎</td>
<td align="left" nowrap><%= comCode%></td>
<td align="left" nowrap><%= riskName %></td>
<td align="left" nowrap><%= insuredName%></td>
<td align="left" nowrap><%= startDate + "--" + endDate%></td>
<td align="left" nowrap><%= currency%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(baseAmount) %></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(basePremium)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(allTotReamount)%></td><!--2013-9-12 WPP -->
<%-- <td align="left" nowrap><%= treatyName %></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(reAmount)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(rePremium)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(totRePaid)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(totReOutStand)%></td>--%>
<%
int j=0;
for(k1=0;k1<schema1.size();k1++){
j=j+1;
// web_R_RepolicyMainInfoDto1 = (Web_R_RepolicyMainInfoDto1)schema1.get(k1-1) ;
web_R_RepolicyMainInfoDto1 = (Web_R_RepolicyMainInfoDto1)schema1.get(k1) ;
web_R_RepolicyMainInfoDto2 = (Web_R_RepolicyMainInfoDto1)schema1.get(k1+1) ;
//out.print(web_R_RepolicyMainInfoDto1.getPolicyNo());
//out.print(web_R_RepolicyMainInfoDto2.getPolicyNo());
// out.print(web_R_RepolicyMainInfoDto3.getPolicyNo());
String treatyName1 = web_R_RepolicyMainInfoDto1.getTreatyName();
double reAmount1 = web_R_RepolicyMainInfoDto1.getReAmount();
double rePremium1 = web_R_RepolicyMainInfoDto1.getRePremium();
double totRePaid1 = web_R_RepolicyMainInfoDto1.getTotRePaid();
double totReOutStand1= web_R_RepolicyMainInfoDto1.getTotReOutstand();
String treatyName2 = web_R_RepolicyMainInfoDto2.getTreatyName();
double reAmount2 = web_R_RepolicyMainInfoDto2.getReAmount();
double rePremium2 = web_R_RepolicyMainInfoDto2.getRePremium();
double totRePaid2 = web_R_RepolicyMainInfoDto2.getTotRePaid();
double totReOutStand2 = web_R_RepolicyMainInfoDto2.getTotReOutstand();
totRePremium1 += rePremium1;
totReAmount1 += reAmount1;
totalRePaid1 += totRePaid1;
totalReOutStand1 += totReOutStand1;
totRePremium2 += rePremium2;
totReAmount2 += reAmount2;
totalRePaid2 += totRePaid2;
totalReOutStand2 += totReOutStand2;
if(web_R_RepolicyMainInfoDto.getRepolicyNo()!=web_R_RepolicyMainInfoDto1.getRepolicyNo()){
for(int m=0;m<countTreatyNo-j;m++){
%>
<td align="left" nowrap></td>
<td align="left" nowrap></td>
<td align="left" nowrap></td>
<td align="left" nowrap></td>
<td align="left" nowrap></td>
<%
}
break;
}
%>
<td align="left" nowrap><%= treatyName1 %></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(reAmount1)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(rePremium1)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(totRePaid1)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(totReOutStand1)%></td>
<%}
%>
</tr>
<%
}}
%>
@培培@java: schema1和schema1的长度大概多少?设个断点看一下
@会长: 大概是20,如果我选择没有数据时,就会出现
如果有数据,就会很慢,也许会一直不出来结果。。。
@会长: 有代码格式工具,你不用?
有两种情况:1.你的for 嵌套循环问题、2.你的后台数据库交互没有关闭连接,释放资源、
@培培@java:
有代码格式工具,你不用?
有两种情况:1.你的for 嵌套循环问题、2.你的后台数据库交互没有关闭连接,释放资源、3.你的页面引入了错误的js文件、
@会长: 艹。到底是谁在提问啊?哈哈哈、
@会长: 哈哈、你得分 ?你要笑死我啊、
有没有哪里有死循环?
就有三个循环也不应该这么慢啊
这是部分代码,我感觉不是死循环啊?
<%
List schema = (List)request.getAttribute("schema");
String treatyName ="";
double reAmount =0.00;
double rePremium = 0.00;
double totRePaid = 0.00;
double totReOutStand = 0.00;
List schema1 = (List)request.getAttribute("schema1");
Web_R_RepolicyMainInfoDto web_R_RepolicyMainInfoDto = new Web_R_RepolicyMainInfoDto();
Web_R_RepolicyMainInfoDto1 web_R_RepolicyMainInfoDto1 = new Web_R_RepolicyMainInfoDto1();
Web_R_RepolicyMainInfoDto1 web_R_RepolicyMainInfoDto2 = new Web_R_RepolicyMainInfoDto1();
Web_R_RepolicyMainInfoDto1 web_R_RepolicyMainInfoDto3 = new Web_R_RepolicyMainInfoDto1();
double totBaseAmount = 0;
double totBasePremium = 0;
double totallTotReamount=0;
double totalRePaid = 0;
double totalReOutStand = 0;
double totReAmount = 0;
double totRePremium = 0;
double totalRePaid1 = 0;
double totalReOutStand1 = 0;
double totReAmount1 = 0;
double totRePremium1 = 0;
double totalRePaid2 = 0;
double totalReOutStand2 = 0;
double totReAmount2 = 0;
double totRePremium2 = 0;
for(int k0 = 0;k0<schema.size();k0++){
int k1;
int k;
%>
<tr>
<%
for(k = 0;k<=k0;k++){
web_R_RepolicyMainInfoDto = (Web_R_RepolicyMainInfoDto)schema.get(k) ;
String policyNo = web_R_RepolicyMainInfoDto.getPolicyNo();
double dangerNo = web_R_RepolicyMainInfoDto.getDangerNo();
String comCode = web_R_RepolicyMainInfoDto.getComCName();
String riskName = web_R_RepolicyMainInfoDto.getRiskName();
String insuredName = web_R_RepolicyMainInfoDto.getInsuredName();
String occupancyName = web_R_RepolicyMainInfoDto.getOccupancyName();
String startDate = String.valueOf(web_R_RepolicyMainInfoDto.getStartDate());
String endDate = String.valueOf(web_R_RepolicyMainInfoDto.getEndDate());
String currency = web_R_RepolicyMainInfoDto.getCurrencyName();
double baseAmount = web_R_RepolicyMainInfoDto.getBaseAmount();
double basePremium = web_R_RepolicyMainInfoDto.getBasePremium();
double allTotReamount=web_R_RepolicyMainInfoDto.getAllTotReamount();//合约总分出保额 2013-9-12 WPP
totBaseAmount += baseAmount;
totBasePremium += basePremium;
totallTotReamount +=allTotReamount;//2013-9-12 WPP
%>
<td align="left" nowrap><%= k+1%></td>
<td align="left" nowrap><%= policyNo %>‎</td>
<td align="left" nowrap><%= comCode%></td>
<td align="left" nowrap><%= riskName %></td>
<td align="left" nowrap><%= insuredName%></td>
<td align="left" nowrap><%= startDate + "--" + endDate%></td>
<td align="left" nowrap><%= currency%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(baseAmount) %></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(basePremium)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(allTotReamount)%></td><!--2013-9-12 WPP -->
<%-- <td align="left" nowrap><%= treatyName %></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(reAmount)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(rePremium)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(totRePaid)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(totReOutStand)%></td>--%>
<%
int j=0;
for(k1=0;k1<schema1.size();k1++){
j=j+1;
// web_R_RepolicyMainInfoDto1 = (Web_R_RepolicyMainInfoDto1)schema1.get(k1-1) ;
web_R_RepolicyMainInfoDto1 = (Web_R_RepolicyMainInfoDto1)schema1.get(k1) ;
web_R_RepolicyMainInfoDto2 = (Web_R_RepolicyMainInfoDto1)schema1.get(k1+1) ;
//out.print(web_R_RepolicyMainInfoDto1.getPolicyNo());
//out.print(web_R_RepolicyMainInfoDto2.getPolicyNo());
// out.print(web_R_RepolicyMainInfoDto3.getPolicyNo());
String treatyName1 = web_R_RepolicyMainInfoDto1.getTreatyName();
double reAmount1 = web_R_RepolicyMainInfoDto1.getReAmount();
double rePremium1 = web_R_RepolicyMainInfoDto1.getRePremium();
double totRePaid1 = web_R_RepolicyMainInfoDto1.getTotRePaid();
double totReOutStand1= web_R_RepolicyMainInfoDto1.getTotReOutstand();
String treatyName2 = web_R_RepolicyMainInfoDto2.getTreatyName();
double reAmount2 = web_R_RepolicyMainInfoDto2.getReAmount();
double rePremium2 = web_R_RepolicyMainInfoDto2.getRePremium();
double totRePaid2 = web_R_RepolicyMainInfoDto2.getTotRePaid();
double totReOutStand2 = web_R_RepolicyMainInfoDto2.getTotReOutstand();
totRePremium1 += rePremium1;
totReAmount1 += reAmount1;
totalRePaid1 += totRePaid1;
totalReOutStand1 += totReOutStand1;
totRePremium2 += rePremium2;
totReAmount2 += reAmount2;
totalRePaid2 += totRePaid2;
totalReOutStand2 += totReOutStand2;
if(web_R_RepolicyMainInfoDto.getRepolicyNo()!=web_R_RepolicyMainInfoDto1.getRepolicyNo()){
for(int m=0;m<countTreatyNo-j;m++){
%>
<td align="left" nowrap></td>
<td align="left" nowrap></td>
<td align="left" nowrap></td>
<td align="left" nowrap></td>
<td align="left" nowrap></td>
<%
}
break;
}
%>
<td align="left" nowrap><%= treatyName1 %></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(reAmount1)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(rePremium1)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(totRePaid1)%></td>
<td align="left" nowrap><%= FormatUtil.douToDouFormat(totReOutStand1)%></td>
<%}
%>
</tr>
<%
}}
%>
@培培@java: 大约有多少数据量?
@Albert Fei: 大约有20条。。。很少的,我差小部分,都不显示的。。。。
@培培@java: 设个断点看看是哪步慢 这么少数据理论上不会出现这样问题的
你也可以先去掉哪一层的循环后 运行下看看什么情况。
多试几次会找出原因的
感觉智商被压制了。。。
我已经智商为0了。。。
断点,调试,保留某一个循环,远行;重复以上操作,看看是那个出问题了,楼上说的很明白了,循环体或者后台数据库交互问题,我是路过的酱油党