Spring/Spring Boot

@RequestParam

hoonssss 2023. 9. 21. 01:03
반응형
SMALL
package com.in28minutes.springboot.myfirstwebapp.login;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import ch.qos.logback.core.model.Model;

@Controller
public class LoginController {
	
	@RequestMapping("login")
	public String gotoLoginPage(@RequestParam String name, ModelMap model) {
		model.put("name", name);
		System.out.println("Request param is " + name); //권장사항아님
		return "login";
	}
}
<html>
	<head>
		<title> Login Page</title>
	</head>
	<body>
		Welcome to the login page! ${name}!
	</body>
</html>

반응형
LIST

'Spring > Spring Boot' 카테고리의 다른 글

name, password 구현  (0) 2023.09.21
logging  (0) 2023.09.21
JSP Login view  (0) 2023.09.20
Spring boot @Controller, @ResposeBody  (0) 2023.09.20
Spring Data JPA  (0) 2023.09.20