*Registration From Application *
1.controller
package com.example.demo;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class Regn_controller {
@GetMapping("/")
public String display(Model model)
{
model.addAttribute("genders", List.of("Male","Female","Other"));
model.addAttribute("countries", List.of("Japan","U.S","Londan"));
model.addAttribute("hobbies", List.of("Football","Cricket","GYM"));
return "register";
}
@PostMapping("registered")
public String getDetails(@RequestParam String username,
@RequestParam String gene,
Model model)
{
model.addAttribute("name", username);
model.addAttribute("gend", gene);
return "success";
}
}
2.Register.html
Registration Form
Name:
Gender:
Country:
Hobby:
Enter fullscreen mode
Exit fullscreen mode
3.Success.html
Registered Successfully
Enter fullscreen mode
Exit fullscreen mode
OUTPUT