File tree Expand file tree Collapse file tree
java/org/launchcode/codingevents
resources/templates/events Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,14 +29,15 @@ public String displayAllEvents(Model model) {
2929
3030 //lives and /events/create
3131 @ GetMapping ("create" )
32- public String renderCreateEventForm (Model model ) {
32+ public String displayCreateEventForm (Model model ) {
3333 model .addAttribute ("title" , "Create Event" );
3434 return "events/create" ;
3535 }
3636
3737 @ PostMapping ("create" )
38- public String createEvent (@ RequestParam String eventName ) {
39- events .add (new Event (eventName ));
38+ public String processCreateEventForm (@ RequestParam String eventName ,
39+ @ RequestParam String eventDescription ) {
40+ events .add (new Event (eventName , eventDescription ));
4041 return "redirect:/events" ;
4142
4243 }
Original file line number Diff line number Diff line change 33public class Event {
44
55 private String name ;
6+ private String description ;
67
7- public Event (String name ) {
8+ public Event (String name , String description ) {
89 this .name = name ;
10+ this .description = description ;
911 }
1012
1113 public String getName () {
@@ -16,6 +18,14 @@ public void setName(String name) {
1618 this .name = name ;
1719 }
1820
21+ public String getDescription () {
22+ return description ;
23+ }
24+
25+ public void setDescription (String description ) {
26+ this .description = description ;
27+ }
28+
1929 @ Override
2030 public String toString () {
2131 return name ;
Original file line number Diff line number Diff line change 1111 < input type ="text " name ="eventName " class ="form-control ">
1212 </ label >
1313 </ div >
14+ < div class ="form-group ">
15+ < label > Description
16+ < input type ="text " name ="eventDescription " class ="form-control ">
17+ </ label >
18+ </ div >
1419 < div class ="form-group ">
1520 < input type ="submit " value ="Create Event " class ="btn btn-success ">
1621 </ div >
Original file line number Diff line number Diff line change 1313 < thead >
1414 < tr >
1515 < th > Name</ th >
16+ < th > Description</ th >
1617 </ tr >
1718 </ thead >
1819 < tr th:each ="event : ${events} ">
1920 < td th:text ="${event.name} "> </ td >
21+ < td th:text ="${event.description} "> </ td >
2022 </ tr >
2123</ table >
2224
You can’t perform that action at this time.
0 commit comments