首页 > 代码库 > 后台数据库取值 轮播图
后台数据库取值 轮播图
<div> <div id="myCarousel" class="carousel slide"> <!-- 轮播(Carousel)指标 --> <ol class="carousel-indicators" style="bottom: 0;"> <c:forEach items="${advertList}" var="advert" varStatus="advert1"> <c:if test="${advert1.index == 0}"> <li data-target="#myCarousel" data-slide-to="${advert1.index}" class="active"></li> </c:if> <c:if test="${advert1.index != 0}"> <li data-target="#myCarousel" data-slide-to="${advert1.index}"></li> </c:if> </c:forEach> </ol> <!-- 轮播(Carousel)项目 --> <div class="carousel-inner"> <c:forEach items="${advertList}" var="advert" varStatus="advert1"> <c:if test="${advert1.index == 0}"> <div class="item active"> <img style="width: 100%;height: 350px" src="${advert.image}" alt="First slide"> </div> </c:if> <c:if test="${advert1.index != 0}"> <div class="item"> <img style="width: 100%;height: 350px" src="${advert.image}" alt="Second slide"> </div> </c:if> </c:forEach> </div> <!-- 轮播(Carousel)导航 --> <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹ </a> <a class="carousel-control right" href="#myCarousel" data-slide="next">› </a> </div> </div>
控制器
@RequestMapping(value = "http://www.mamicode.com/homepage") public String homepage(Model model) { // 获取广告对象 List<CmsAdvert> advertList = cmsAdvertService.findList(new CmsAdvert()); model.addAttribute("advertList", advertList); return "modules/cms/show/homepage"; }
后台数据库取值 轮播图
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。