其他分享
首页 > 其他分享> > 测试开发进阶——spring boot——MVC——thymeleaf模板——打开网页

测试开发进阶——spring boot——MVC——thymeleaf模板——打开网页

作者:互联网

spring  boot中默认支持thymeleaf模板。可以直接使用

package com.awaimai.web;

import com.alibaba.fastjson.JSONObject;
import org.hibernate.validator.constraints.*;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Size;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

@Controller
@Validated
public class kzq
{


    @RequestMapping(value = "/test3")
    public String test3()
    {

        return "index";

    }




}

  

 

 

 

html:

 

<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org"></html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
        hello
</body>
</html>

  

 

 

 

 

 

 

 

 

web访问:

 

标签:进阶,spring,boot,springframework,org,import,validation,javax,constraints
来源: https://www.cnblogs.com/xiaobaibailongma/p/15112007.html