日期:2014-05-17  浏览次数:20712 次

关于页面传值和导出的问题
情况是这样:我在后台ACTION中从TXT文件中读取了所有的数据组成了一个list,并且我把这个list中错误的数据拿了出来组成另一个wringlist
Java code

fileList = ReadExcelForKeeprepair.getInfoForCompany(is,this.sessionContainer,this.clazz.toString());
                for(int i=0;i<fileList.size();i++)
                {
                    boolean flag = true;
                    CompanyConsignmentReceiveInfo cpInfo = new CompanyConsignmentReceiveInfo();
                    cpInfo = (CompanyConsignmentReceiveInfo) fileList.get(i);
                    if((cpInfo.getMachineNo().length()) != 9 || "".equals(cpInfo.getMachineNo()))
                    {
                        cpInfo.setMachineNo(cpInfo.getMachineNo()+"(错误)");
                        cpInfo.setWringid(i+1);
                        flag = false;
                    }
                    if("".equals(cpInfo.getConsignmentDate()) || cpInfo.getConsignmentDate().length() != 10)
                    {
                        cpInfo.setConsignmentDate(cpInfo.getConsignmentDate()+"(错误)");
                        cpInfo.setWringid(i+1);
                        flag = false;
                    }
                    if("".equals(cpInfo.getItemcode()))
                    {
                        cpInfo.setItemcode(cpInfo.getItemcode()+"(错误)");
                        cpInfo.setWringid(i+1);
                        flag = false;
                    }
                    if("".equals(cpInfo.getDealerCode()))
                    {
                        cpInfo.setDealerCode(cpInfo.getDealerCode()+"(错误)");
                        cpInfo.setWringid(i+1);
                        flag = false;
                    }
                    if("".equals(cpInfo.getContractNo()))
                    {
                        cpInfo.setContractNo(cpInfo.getContractNo()+"(错误)");
                        cpInfo.setWringid(i);
                        flag = false;
                    }
                    if(flag==false)
                    {
                        wringfilelist.add(cpInfo);
                    }
                }
                if(wringfilelist.size()!=0)
                {
                    request.setAttribute("wringfilelist", wringfilelist);
                    return getMyselfForward(mapping, applyForm, request, response);
                }


我把这个wringlist通过request传到了页面并且用logic:iterate标签遍历显示了出来
HTML code

<logic:present name="wringfilelist" scope="request"> 
                            <logic:iterate id = "result_exam" name = "wringfilelist" >
                                        <%if(i % 2 == 0 ){ %>
                                        <tr class="table_c1">
                                        <%}else{ %>
                                        <tr class="table_c2">
                                        <%} %>                                                                                        
                                            <td style="word-wrap: break-word; word-break: break-all"><bean:write name='result_exam' property='wringid'/></FONT></td>
                                            <td style="word-wrap: break-word; word-break: break-all"><bean:write name='result_exam' property='machineNo'/></td>
                                            <td style="word-wrap: break-word; word-break: break-all"><bean:write name='result_exam' property='itemcode'/></td>
                                            <td sty