针对于一个列表中的对象数据,动态展示到jsp上的放以及在jsp取对应map中对应key的值
代码:
@Data
public class MIndexBannerTypeimplements Serializable {
private Integerid;
private IntegerbannerType;
private Stringname;
private DatecreateTime;
}
public String getList(Page page, ModelMap map, HttpServletRequest request) {
List mIndexBannerTypeList =mIndexBannerService.getMIndexBannerTypeList();
HashMap maps =new HashMap<>();
mIndexBannerTypeList.forEach(banner->{
maps.put(banner.getBannerType(),banner.getName());
});
request.setAttribute("maps",maps);
}
jsp代码:
<c:out value="${maps[vo.bannerType]}"></c:out>