课后作业
任务:创建Spring Boot项目输出学生信息
创建Spring Boot项目StudentInfo
查看它给我们配置的pom.xml文件
创建控制器StudentInfoController
package net.lhf.lesson01.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 功能:HelloWorld02控制器
* 作者:李红芙
* 日期:2021年4月21日
*/
@Controller
public class StudentInfoController {
@ResponseBody
@RequestMapping("/studen")
public String studen(){
return "<h3>学号:19205055</h3>" +
"<h3>姓名:李红芙</h3>" +
"<h3>性别:女</h3>" +
"<h3>年龄:20</h3>" +
"<h3>专业:软件技术</h3>" +
"<h3>电话:12324466</h3>" +
"<h3>爱好:听歌、看书</h3>";
}
}
运行启动类,在浏览器访问http://localhost:8080/student