1、对HelloSchool类中添加数据
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@ResponseBody
public class HelloSchool {
@RequestMapping("/hello")
public String hello(String name,int age){
return "学生的姓名为:"+name+",年龄为:" +age;
}
}
2、在Main下运行
3、在浏览器中输入“http://127.0.0.1:8080/hello?name=%E5%B0%8F%E7%8C%AA&age=18”