美文网首页
jsp列表页中显示动态map key对应的值的数据

jsp列表页中显示动态map key对应的值的数据

作者: 嘴角的白糖雪 | 来源:发表于2019-09-29 17:52 被阅读0次

针对于一个列表中的对象数据,动态展示到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>

相关文章

网友评论

      本文标题:jsp列表页中显示动态map key对应的值的数据

      本文链接:https://www.haomeiwen.com/subject/qxnfpctx.html