web作业5-7

发布时间:2026/7/9 8:36:35
web作业5-7 Web作业5package com.example;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;SpringBootApplicationpublic class DemoApplication {public static void main(String[] args) {SpringApplication.run(DemoApplication.class, args);}}package com.example.controller;import org.springframework.web.bind.annotation.*;RestControllerpublic class RegisterController {// 显示注册表单 (GET /reg3)GetMapping(/reg3)public String showForm() {return !DOCTYPE html\n html\n headmeta charsetUTF-8title用户注册/title/head\n body\n h2用户注册/h2\n form action/reg3 methodpost\n 姓名input typetext namename required/br/br/\n 年龄input typenumber nameage required/br/br/\n 性别\n input typeradio namegender valuemale/男\n input typeradio namegender valuefemale/女br/br/\n input typesubmit value提交注册/\n /form\n /body\n /html}}package com.example.controller;import org.springframework.web.bind.annotation.*;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RestController;import org.springframework.boot.SpringApplication;RestControllerpublic class HellowController {GetMapping(/hello)public String hello() {return Hello;}}Web作业6springboot的请求和响应学习requestresponse:表格Web作业7课上案例复现和代码