emis相关的一些备忘

来源:互联网 发布:神武2手游多开软件 编辑:程序博客网 时间:2024/05/02 02:41

1、参数传递问题

如果我点某个按钮打开一个JSP页面,参数写在这个URL地址的后边,页面里边有z:init方法,我想把参数再继续传递给z:init调用的方法,可以使用如下途径:

<script type="text/javascript">
  Page.onLoad(function(){
   <%request.setAttribute("ParentID", request.getParameter("ParentID"));%>
  });
}

</script>

就是在页面加载时将参数设置到请求中去,这样z:init方法在后台就可以直接取到这个参数了:

public static Mapx initTypeDialog(Mapx params) {
  String parentID = params.getString("ParentID");
  if ((parentID == null) || (parentID.equals("0")) || (StringUtil.isEmpty(parentID))) {
   params.put("Prop1", HtmlUtil.codeToOptions("ThingType", true));
  } else {
   ZCCatalogSchema pCatalog = new ZCCatalogSchema();
   pCatalog.setID(parentID);
   pCatalog.fill();

   params.put("Prop1", HtmlUtil.codeToOptions("ThingType", pCatalog.getProp1()));
  }

  return params;
 }

2、通过url传递给一个页面,如果这个页面要导出excel,则在页面的onload事件中,需要给dga设置传入的参数,否则即使查询条件部分定义了相关参数的输入域,导出时也取不到传入的值:

Page.onLoad(function(){
        //url传入的参数,一定要在这里设置下,不然即使下边的查询条件有传入的参数,导出时也会取不到传入参数的值,导致导出Excel数据有问题
  DataGrid.setParam("dg1", "ThingStatus", "<%=request.getParameter("ThingStatus")%>");
  DataGrid.setParam("dg1", "Bads", "<%=request.getParameter("Bads")%>");
 });

查询部分:

<tr>
     <td style="padding:8px 10px;">
      <!--<z:tbutton onClick="print()"><img src="../../Icons/icon018a4.gif" />打印</z:tbutton>-->
      <div style="float: left white-space: nowrap;">
      <input type="hidden" name="ThingStatus" id="ThingStatus" value="<%=request.getParameter("ThingStatus") %>" />
      <input type="hidden" name="Bads" id="Bads" value="<%=request.getParameter("Bads") %>" />
                  <span >
                    <strong>制单日期</strong>&nbsp;<input type="text" id="StartDate" name="StartDate" size="13" ztype="Date" class="inputText" value="${StartDate}">
      <strong>至</strong>&nbsp;<input type="text" id="EndDate" name="EndDate" size="13" ztype="Date"  class="inputText" value="${EndDate}">
                  </span>
                  <strong>类型:</strong><z:select id="ThingType" name="ThingType" style="width:70px" onChange="changeCondition()">${ThingType}</z:select>
      <strong>仓库:</strong><z:select id="WarehouseID" name="WarehouseID" style="width:100px" listWidth="80" onChange="changeCondition()">${WarehouseID}</z:select>
      <strong>状态:</strong><z:select id="Status" style="width:70px" onChange="changeCondition()">${Status}</z:select>
      <input type="text" id="SearchCode" name="SearchCode" value="请输入单号" onFocus="delKeyWord();" style="width:90px">
      <input type="text" id="SearchCode1" name="SearchCode1" value="请输入品名或编码" onFocus="delKeyWord();" style="width:90px">
      <input type="button" name="Submitbutton" id="Submitbutton" value="查询" onClick="doSearch()"></div>
     </td>
    </tr>

url参数:StoreInQuery.jsp?ThingStatus=0&Bads=0