Registration From Application in Spring boot java

*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: 3.Success.html Registered Successfully OUTPUT

Apr 17, 2025 - 13:38
 0
Registration From Application in Spring boot java

*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

    
    
        








3.Success.html

Registered Successfully

OUTPUT

Image description

Image description