@Controller
@RequestMapping("/member")
public class OAuthController {
@ResponseBody
@GetMapping("/name")
public String abcCallback(@RequestParam String code,Model model){
abc=service.getname(code);
model.addAttribute("abc",abc);
return "/main.html";
}
}
i省略extra。我想返回模型到main.html [located in src/main/resources/templates/main.html]
但是当我运行这个。它显示的是/main.html我应该更改注释吗?我困惑
change return"main.html"
, return "main"change annotation@restController
但不工作
@RestController
同时拥有@Controller
和@ResponseBody
。这里的问题是@ResponseBody
,它需要被删除。
@Controller
@RequestMapping("/member")
public class OAuthController {
@GetMapping("/name")
public String abcCallback(@RequestParam String code,Model model){
abc=service.getname(code);
model.addAttribute("abc",abc);
return "main";
}
}