springboot更换网页轮播图

1.方法使用findall方法

 public List<newsType> findAll(){
     
        return newsTypeDao.findAll();
    }

2.controller

 @RequestMapping("/tomain")
    public String getEdit(Model model){
     
        List<newsType> newsData = newsTypeService.findAll();
        model.addAttribute("newsData",newsData);
        return "main";
    }

3.html

<div class="banner slideBox" >
        <div class="bd">
            <ul class="bannerBox">
                <li class="show" th:each="vo,key : ${newsData}">
                    <a href="http://www.qwangluo.com/" target="_blank">
                        <img th:src="${vo.nt_filename}" alt="">
                    </a>
                </li>
            </ul>
</div>

你可能感兴趣的:(Java,框架学习)