MemberController
Opened this issue · 0 comments
bitcocom commented
package com.example.bootgsm01.controller;
import com.example.bootgsm01.entity.Member;
import com.example.bootgsm01.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
@Controller
public class MemberController {
@Autowired
private MemberService memberService;
//@RequestMapping
//@GetMapping
//@PostMapping
//@PutMapping
//@DeleteMapping
@RequestMapping("/hello")
public String hello(Model model){
model.addAttribute("name", "홍길동");
return "hello"; // forward-->/WEB-INF/views/hello.jsp
// templates/hello.html
}
@RequestMapping("/userRegister")
public @ResponseBody Member userRegister(){
Member member=new Member();
member.setName("박매일");
member.setAge(45);
return memberService.userRegister(member);
}
}