Controller 里的代码
List<Long> categoryIds =new ArrayList<>();
List<PromotionThemeRelationVO> caterotyList =promotionThemeVO.getCategoryRelationList(); categoryIds =CommonUtil.getValueList(caterotyList,"relationId");
request.setAttribute("cIds",JsonUtils.toJson(categoryIds));
页面里承接的代码
var categoryIds =${cIds};js里的代码
var categoryCache={},editCategoryIdsJ={};;
if(categoryIds && categoryIds.length>0){ for(var i=0;i<categoryIds.length;i++){ editCategoryIdsJ[categoryIds[i]]=categoryIds[i]; } }