我正在尝试使用 thymleef 和 springboot 打印到屏幕

问题描述 投票:0回答:0

这就是我试图在 html 上显示的内容

                             <div class="review">
                                <div class="row">
                                    <!--end col-md-3-->
                                    <div class="col-md-9">
                                        <div class="comment">
                                            <div class="comment-title">
                                                <h4>
                                                    <td th:text="${username}"></td>
                                                </h4>
                                            </div>
                                            <dl class="visitor-rating">
                                                <dt>user ID</dt>
                                                <dd><td th:text="${userid}"></td></dd>
                                                <dt>user Tel.</dt>
                                                <dd><td th:text="${tel}"></dd>
                                                <dt>user email</dt>
                                                <dd><td th:text="${email}"></dd>
                                            </dl>
                                        </div>
                                    </div>
                                </div>
                            </div>

这就是尝试从控制器发送数据的方式

    String username = memDto.getUsername();
    String email = memDto.getEmail();
    String tel = memDto.getTel1();
    String userid = memDto.getUserid();
    
    mav.addObject("username", username);
    mav.addObject("email", email);
    mav.addObject("tel", tel);
    mav.addObject("userid", userid);

我在数据库中有数据,但我不知道为什么数据不显示

spring-boot thymeleaf
© www.soinside.com 2019 - 2024. All rights reserved.