转载请标明出处: http://blog.csdn.net/forezp/article/details/71023868 本文出自方志朋的博客
这篇文件主要介绍通过springboot 去创建和提交一个表单。
涉及了 web,加上spring-boot-starter-web和spring-boot-starter-thymeleaf的起步依赖。
org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-starter-thymeleaf代码清单如下:
public class Greeting { private long id; private String content; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } }src/main/resources/templates/greeting.html
Getting Started: Handling Form Submission Form Id: Message:src/main/resources/templates/result.html
Getting Started: Handling Form Submission Result Submit another message启动工程,访问ttp://localhost:8080/greeting:
点击submit:
https://spring.io/guides/gs/handling-form-submission/
https://github.com/forezp/SpringBootLearning