-
Notifications
You must be signed in to change notification settings - Fork 164
[Spring MVC] 민지인 미션제출합니다 #503
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d00ac48
[Feat] 홈 화면, 예약 조회 화면
jxxxxxn 5fddb60
[Feat] return값에서 .html 삭제
jxxxxxn a120bd3
[Feat] reservation() Model 추가, 예약 초기 데이터 추가
jxxxxxn b3cf994
[Feat] reservations() @ResponseBody로 수정
jxxxxxn 81259f3
[Feat] dto 멤버변수 private으로 변경
jxxxxxn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/roomescape/controller/ReservationController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package roomescape.controller; | ||
|
|
||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.stereotype.Controller; | ||
| import org.springframework.ui.Model; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.ResponseBody; | ||
| import roomescape.dto.Reservation; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
|
|
||
| @Controller | ||
| public class ReservationController { | ||
|
|
||
| Reservation reservation1=new Reservation(1L,"브라운","2023-01-01","10:00"); | ||
| Reservation reservation2=new Reservation(2L,"브라운","2023-01-02","11:00"); | ||
| private List<Reservation> reservations = new ArrayList<>(Arrays.asList(reservation1,reservation2)); | ||
|
|
||
| @GetMapping("/reservation") | ||
| public String reservation(Model model){ | ||
|
|
||
| model.addAttribute(reservations); | ||
| return "reservation"; | ||
| } | ||
|
|
||
| @GetMapping("/reservations") | ||
| @ResponseBody | ||
| public List<Reservation> reservations(){ | ||
|
|
||
| return reservations; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package roomescape.controller; | ||
|
|
||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.stereotype.Controller; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
|
|
||
| @Controller | ||
| public class StartController { | ||
|
|
||
| @GetMapping("/") | ||
| public String home(){ | ||
| return "home"; | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package roomescape.dto; | ||
|
|
||
| import java.sql.Date; | ||
| import java.sql.Time; | ||
| import java.time.LocalDate; | ||
| import java.time.LocalTime; | ||
|
|
||
| public class Reservation { | ||
| public Long id; | ||
| public String name; | ||
| public String date; //우선 String으로.. 차후 Date로 형변환 필요하면 교체.. | ||
| public String time; //동일!! | ||
|
|
||
| public Reservation(Long id,String name,String date,String time){ | ||
| this.id=id; | ||
| this.name=name; | ||
| this.date=date; | ||
| this.time=time; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
제가 놓쳤네요! 필드의 접근 지정자를 무엇으로 설정해야 할까요? public vs private 에 대해 공부해보면 좋을 것 같습니다.