<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 一、概述 整合了各層技術的完整運行技術; ## 二、說明 1、pom 包里確保Jpa 和 Thymeleaf 的相關包引用 ~~~ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> ~~~ 2、application.properties中確保有配置 ~~~ spring.datasource.url=jdbc:mysql://127.0.0.1/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true spring.datasource.username=root spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.jpa.properties.hibernate.hbm2ddl.auto=create spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect spring.jpa.show-sql= true spring.thymeleaf.cache=false ~~~ 3、在項目 resources 目錄下會有兩個文件夾 static目錄用于放置網站的靜態內容如 css、js、圖片; templates 目錄用于放置項目使用的頁面模板。 ![](https://img.kancloud.cn/60/4a/604a5ec46ac5ddf84cbb861efa86283a_263x273.png) ## 三、代碼實現 ## **dao層** 提供數據的CRUD; ## **service層** 通過調用持久層來組合業務,并作為資源注入給Controller 層;業務層可以直接用實現類,也可以用接口+實現類,一般為了簡化,直接用實現類即可; ## **controller層** Controller 負責接收請求,處理完后將頁面內容返回給前端; 常用的分為兩種: @RestController 在 Spring MVC 中就是 @Controller 和 @ResponseBody 注解的集合,它默認是json對象返回給請求端,而不是頁面,一般用于api請求返回結果; @Controller則返回到指定頁面,一般用于web頁面請求; 注意: >[danger] `return "sample/access/list";`代表會直接去 resources 目錄下找相關的文件。 > `return "redirect:/list";`代表轉發到對應的 Controller,這個示例就相當于刪除內容之后自動調整到 list 請求,然后再輸出到頁面。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看