struts1标签循环里面的判断

<%@ page language="java" contentType="text/html; charset=GBK" import="java.util.*, java.text.*" pageEncoding="GBK"%>
<%@include file="/commons/taglibs.jsp"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/tag.tld" prefix="tag"%>
<%@include file="/ui/jsp/initJs.jsp"%>
<%@include file="/ui/jsp/initCss.jsp"%>
<%@page import="com.post.util.Utils"%>


<base href="<%=basePath%>">
<html>
<head>
<tag:res path="/js/calendar/WdatePicker.js" attr="defer='defer'"></tag:res>
<tag:res path="/js/Check.js"></tag:res>
<tag:res path="/js/jquery.js"></tag:res>
<script language=javascript type="text/javascript">
var $j = jQuery.noConflict();
</script>

<tag:res path="/mgnt/StateBatchDemand/css.css"></tag:res>
<title>客户对账</title>
<script language="javascript" type="text/javascript">

function getForm(){
   return BasicForm;  
}

//导入邮件text表
function click_imp(){
  var   textFile=document.all("textFile").value;
  //alert(textFile);  //文件的路径名称
document.all('filePath').value=textFile;
  // 若取不到绝对路径在浏览器设置:工具 -> Internet选项 -> 安全 -> 自定义级别 -> 找到“其他”中的“将本地文件上载至服务器时包含本地目录路径”,选中“启用”即可。
if(null == textFile || '' == textFile){
alert('请要导入的txt文件!')
return;
}
else{
BasicForm.submit();
}
}


function downLoad(url){
var a=url.indexOf('filePath');
var b=url.length;
var c=url.substring(a+9, b);
if(c.length>0){  //表示有路径
var form=getForm();
form.action = url;
}else{
alert("查询的文件未生成,不能下载");
  }
         }
    
  function cancelQuery(url){
var form=getForm();
var b=url.length;
form.action = url;
form.submit();
  }
 
    //下载文件
  function downFile(url){
var a=url.indexOf('filePath');
var b=url.length;
var c=url.substring(a+9, b);
    if(c.length>0){
    window.location.href=url;
    }else{
    alert("查询的文件未生成,不能下载");
    }
 
      }
   
   
   function cls(a){
    alert(a);
  
  
   }
   
   
 
</script>
</head>
<body class="nobg">
 
<html:form action='mail/mgnt/CustQuery.do?method=list' method="post">
  <input type="hidden" id="filePath" name="filePath"/>
  <div class="wrap0">
  <div class="left">
      <label>选择要导入的邮件号文件<font color="red" >*</font></label>
          <input type="file" size="14" name="textFile" id="textFile"/>
             <div class="buttons">
    <button class="positive" name="qry" onClick="javascript:click_imp()">
        <img src="ui/images/search.gif" alt=""/>导入
    </button>
  </div>
  </div>
  <!-- 列表部分开始 -->
  <table border="0" cellspacing="0" cellpadding="0" class="detail state" id="showTable">
  <thead>
    <tr>
  <th>查询批次</th>
  <th>查询时间</th>
  <th>邮件数(个)</th>
  <th>查询进度</th>
  <th>查询结果</th>
  <th>取消</th>
</tr>
</thead>
<tbody>
<%int k=1; %>
    <logic:present name="volist">
      <bean:define id="list" name="volist"/>
      <logic:empty name="list">
      <tr>
      <td colspan="6">当前查询的结果为空,请重新查询!</td>
      </tr>
      </logic:empty>
      <logic:iterate id="li" name="list">
        <bean:define id="ub" name="li" type="Map"/>
       
       
        <%k+=1; %>
    <tr>
<td style="text-align: center;">
<bean:write name="ub" property="REQ_CODE" />&nbsp;&nbsp;
</td>

<td style="text-align: center;">
<bean:write name="ub" property="REQ_TIME" />&nbsp;&nbsp;
</td>
          

<td style="text-align: center;">
<bean:write name="ub" property="AL_MAIL" />&nbsp;&nbsp;
</td>

<td style="text-align: center;">
  
<bean:write name="ub" property="PC" />&nbsp;&nbsp;

</td>
<td style="text-align: center;"> 

             <!--此处判断 list里的一个字段属性是否等于一个常量。。。。。。。。-->
                    <logic:equal name="ub" property="IS_PATH" value="1">
                           <input type="button"  onclick="downLoad('<%=request.getContextPath()%>/mail/mgnt/CustQuery.do?method=downLoadResult&filePath=<bean:write name="ub" property="FILE_PATH" />')" value="下载">
                   </logic:equal>



    </td>
<td style="text-align: center;">
<button class="positive" name="qry" onclick="cancelQuery('<%=request.getContextPath()%>/mail/mgnt/CustQuery.do?method=cancelQuery&reqCode=<bean:write name="ub" property="REQ_CODE" />')">
        <img src="images/y_ico_hidden.gif" alt=""/>取消
    </button>
</td>
</tr>
      </logic:iterate>
    </logic:present>
</tbody>
    <!-- 字段内容部分结束 -->
  </table>
  <iframe id="myframe" src="" frameborder="0" scrolling="0" name="detail" style="display: none;width: 800px;height: 460px;"></iframe>
</div>
</html:form>
</body>
</html>

你可能感兴趣的:(struts1)