spring-boot 最近比较火,
但是也要有spring spring-mvc 等基础,他是将其他框架融合,便于快速开发
废话不说,
入门常见的问题,404 再不到路进
不知道,你是否忘记,web-inf 是一个保护文件,不能放在里买,如果要放在里面,则需要声明,为简单,我直接放在webapp 下的jsp文件夹里
The @RestController and @RequestMapping annotations
对于这两个的理解,这是官网上的,,也可以百度
RestController RequestMapping 直接放回数据
Controller RequestMapping 放回资源文件
The first annotation on our Example
class is @RestController
. This is known as astereotype annotation. It provides hints for people reading the code, and for Spring,that the class plays a specific role. In this case, our class is a web @Controller
soSpring will consider it when handling incoming web requests.
The @RequestMapping
annotation provides “routing” information. It is telling Springthat any HTTP request with the path “/” should be mapped to the home
method. The@RestController
annotation tells Spring to render the resulting string directlyback to the caller.
上传一个可以运行的spring-boot jsp
spring-boot 开发文档
https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#using-boot-maven-without-a-parent