html
注册
请输入注册信息
Controller
package com.example.test.controller;
import com.example.test.service.mailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Random;
@Controller
public class MailController {
@Autowired(required = false)
private mailService mail;
// @RequestMapping("getCheckCode/{email}") @PathVariable(name="email")
// @RequestMapping("getCheckCode")
@GetMapping("getCheckCode")
@ResponseBody
public Str
package com.example.test.controller;
import com.example.test.service.mailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Random;
@Controller
public class MailController {
@Autowired(required = false)
private mailService mail;
// @RequestMapping("getCheckCode/{email}") @PathVariable(name="email")
// @RequestMapping("getCheckCode")
@GetMapping("getCheckCode")
@ResponseBody
public String getCheckCode(String email){
String checkCode = String.valueOf(new Random().nextInt(899999) + 100000);
System.out.println("=================");
System.out.println(email);
System.out.println("=================");
System.out.println(checkCode);
System.out.println("=================");
String message = "您的注册验证码为:"+checkCode;
try {
mail.sendSimpleMail(email, "注册验证码", message);
}catch (Exception e){
return "";
}
return checkCode;
}
@RequestMapping("hahaha")
public String hahaha(){
return "HaHaHa";
}
@RequestMapping("register")
public String register(String email,String password,String checkCode){
System.out.println(email+"==="+password+"===="+checkCode);
return "";
}
}



