EL表达式两个foreach嵌套循环

集合List中加List泛型的泛型

List riskEvaSuitQuestionList = riskEvaSuitQuestionService.getQueList(1000036L);
model.addAttribute("riskEvaSuitQuestionList",riskEvaSuitQuestionList);

List riskEvaSelectItemList;
List> riskEvaSelectItemLists = new ArrayList<>(); //双重泛型的构建
for (int i = 0; i < riskEvaSuitQuestionList.size(); i++) {
    riskEvaSelectItemList = riskEvaSelectItemService.getByQuestionId(riskEvaSuitQuestionList.get(i).getQuestionId());
    riskEvaSelectItemLists.add(riskEvaSelectItemList);
}
 model.addAttribute("riskEvaSelectItemLists", riskEvaSelectItemLists);

两个foreach可以直接像if一样嵌套用:


下面是一开始以为foreach不能嵌套出现的方法(看起来就头疼):

   //第一个foreach
   

${i.count}.${item.content}


//第二个foreach ${riskEvaSelectItemLists.get(i.count-1).get(j.count-1).itemContent}


注意:javascript中默认加分默认为字符串相加,必须转换为parseInt()

           往input标签中写值,直接定位该标签,然后.value = 值

           javascript中也可以应用域对象取值



你可能感兴趣的:(家瓦喂簸)