spring boot初識(三) 請求到頁面

2021-08-31 18:49:18 字數 688 閱讀 1991

服務接收到http請求後,跳轉到指定頁面。

首先有乙個支援該請求的服務類,**如下:

@controller

public class htmlcontroller

}

在/springbootdemo/src/main/resources/templates目錄下放乙個簡單的靜態頁面

這是個靜態頁面。

在瀏覽器中請求http://localhost:9999/html/static,報錯

pom.xml中加入依賴:

org.springframework.boot

spring-boot-starter-thymeleaf

spring:

mvc:

view:

prefix: /templates/

suffix: .html

重啟後重試:

成功!

初識ajax GET POST請求

03get.html 03check.php uname get username pw get password if uname admin pw 123 else get post區別 get傳送的時候資訊顯示在位址列 post是傳送時引數會放在傳送體send param 中,不顯示在位址列,...

初識springboot 引入thymeleaf

因為springboot不支援jsp 使用模板引擎 寫乙個頁面模板,和資料交給模板,生成乙個頁面。推薦thymeleaf 語法簡單功能強大,1.引入thymeleaf org.springframework.boot spring boot starter thymeleaf 修改版本 1.8 3....

springboot請求引數

spring boot專欄 主目錄這裡的入參跟 springboot請求域共享 是對應的,請求域是將資料傳遞給前台,而請求引數 入參 是繫結獲取前台的資料。employee實體類 private integer id private string lastname employeecontrolle...