-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hung #57
base: master
Are you sure you want to change the base?
Hung #57
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Push thừa: thư mục
.idea
,target
import java.util.Optional; | ||
|
||
@RestController | ||
public class UserController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Đáng ra phải là UserService
chứ?
e nên nhớ: có 3 tầng chính mà mình phải định nghĩa: Repo, Service, Controller
|
||
|
||
@Autowired | ||
private UserController userController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
không được phép gọi Controller trong 1 controller khác
return "add"; | ||
} | ||
@PostMapping("add") | ||
public String submitFormAdd(@RequestParam("name") String name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e k cần đẩy lên từng field một như thế này, sử dụng @ModelAttribute
để đẩy lên cả đối tượng User
có thể tham khảo code phía bạn VuVanTung
return "edit"; | ||
} | ||
@PostMapping("edit/{id}") | ||
public String submitEdit(@PathVariable("id") Long id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tương tự trên, dùng @ModelAttribute
No description provided.