在这段代码中,我声明了一个变量,其中包含 List 的值,即acode
. 我可以看到此列表中的值,但我不知道如何使用adao.adao.findAllacctDesc(**acode**)
. 我如何遍历此列表,以便选项显示值?
这是代码:
<%
TblTaxTypeDAO tdao = DAOFactory.getDaoManager(TblTaxType.class);
TblAccountCodesDAO adao = DAOFactory.getDaoManager(TblAccountCodes.class);
List<TblTaxType> acode = null;
String tcode = request.getParameter("taxt");
String bcode = request.getParameter("bfns");
acode = tdao.findAllAcctCode(bcode, tcode);
Debugger.print(acode);
List<TblAccountCodes> acctdesclist = null;
acctdesclist = adao.findAllacctDesc(acode); <= Having error in this line because acode is a list not a string.
String acctdescoptions = "";
if( acctdesclist!=null) {
if( acctdesclist.size()>0 ) {
for(int i=0; i<acctdesclist.size();i++) {
TblAccountCodes acctcode = (TblAccountCodes) acctdesclist.get(i);
acctdescoptions += "<option value='"+acctcode.getAcctCode()+"'>"+acctcode.getAcctDesc()+"</option>";
acctcode = null;
}
}
}
adao = null;
acctdesclist = null;
%>
<%=acctdescoptions%>