package com.example.first.hello;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Helloworld {
@RequestMapping("/users/demo")
public String data() {
String result = “\r\n” +
“<html lang=“zh-CN”>\r\n” +
“\r\n” +
“\r\n” +
" <meta charset=“utf-8”>\r\n" +
" <meta http-equiv=“x-ua-compatible” content=“ie=edge”>\r\n" +
"
" <meta name=“viewport” content=“width=device-width, initial-scale=1”>\r\n" +
“\r\n” +
“\r\n” +
“\r\n” +
" \r\n" +
" <tr style=“color:red”>\r\n" +
" \r\n" +
" \r\n" +
" \r\n" +
" \r\n" +
" \r\n" +
"
1 | 1 | 1 | 1 |
“\r\n” +
“\r\n” +
“\r\n” +
“”;
return result;
}
}
运行结果
pom.xml
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.1.2.RELEASE
com.example
first
0.0.1-SNAPSHOT
first
Demo project for Spring Boot
<java.version>1.8</java.version>
org.springframework.boot
spring-boot-starter-web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>