标签:
<%@page import="net.sf.json.JSONObject"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.HashMap"%>
String sql = "select b.CardCode,b.cardname from Wbtx_Tkhjbxx b where b.id in (select distinct a.wbtx_tkhjbxx_id from wbtx_Tkhjbxx_YWYXX a where a.xsy = "+UserContext.getContext().getUser().getId()+")";
String cusCode = "";
String cardname="";
List list=new ArrayList();
List list1=new ArrayList();
ApexRowSet rs_1 = null;
rs_1 = ApexDao.getRowSet(DataAccess.getDataSource(), sql);
while(rs_1.next()){
HashMap<String, Object> sh=new HashMap<String, Object>();
JSONObject node = new JSONObject();
cusCode = rs_1.getString("CardCode");
cardname = rs_1.getString("cardname");
sh.put("cusCode",cusCode);
sh.put("cardname",cardname);
node.put("cusCode",cusCode);
node.put("cardname",cardname);
list.add(sh);
list1.add(node);
}
request.setAttribute("list",list);
request.setAttribute("list1",list1);
<%
for(int i=0;i<list.size();i++){
HashMap hm=(HashMap)list.get(i);
%>
<option value="<%=hm.get("cusCode") %>"><%=hm.get("cardname") %></option>
<%
}
%>
//js中
var contactorList = <%=request.getAttribute("contactorList")%>;
for(var i in contactorList) {
var khdm=contactorList[i].khdm;
var contactor=contactorList[i].contactor;
if(khdm == v_cusCode) {
var option = document.createElement("option");
option.innerHTML=contactor;
option.value=khdm;
select2.appendChild(option);
}
}
标签:
原文地址:http://www.cnblogs.com/zkx4213/p/4893124.html