Last active
April 23, 2018 21:41
-
-
Save fuchodeveloper/84176038b56beaaa4c33b0aaa5a7e63f to your computer and use it in GitHub Desktop.
Form controller file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hello; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.ui.Model; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.ModelAttribute; | |
import org.springframework.web.bind.annotation.PostMapping; | |
@Controller | |
public class HelloController { | |
@GetMapping("/hello") | |
public String helloForm(Model model) { | |
model.addAttribute("hello", new Hello()); | |
return "hello"; | |
} | |
@PostMapping("/hello") | |
public String helloSubmit(@ModelAttribute Hello hello) { | |
return "result"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment