728x90
반응형
1. @RequestParam String...
- HttpServletRequest의 request.getParameter와 기능이 거의 동일하다.
// Controller.java
package com.test.contparam.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class Test1Controller {
@RequestMapping("/test1")
public String one(@RequestParam String id, @RequestParam int age, Model model) {
model.addAttribute("id", id);
model.addAttribute("age", age);
return "test1";
}
}
// one.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<div align="center">
<h1>Test1</h1>
<P> id : ${ id } </P>
<P> age : ${ age } </P>
</div>
</body>
</html>
2. @ReqeustParam Map
728x90
반응형
'Backend > Spring' 카테고리의 다른 글
[Spring Boot] Jasypt로 프로퍼티 암호화하기 (1) | 2023.10.23 |
---|---|
[Spring] 객체 지향 프로그래밍 설계 5대 원칙, SOLID (0) | 2023.10.12 |
[Spring Boot] JPA / Spring Data JPA / Hibernate (0) | 2023.10.10 |
[Spring] Gradle / Maven, (Gradle의) Kotlin / Groovy (0) | 2023.09.19 |
[Spring] 인프런 강의 - 인텔리제이 (0) | 2023.08.09 |