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 @@ -34,8 +34,9 @@ public String displayCreateEventForm(Model model) {
3434 }
3535
3636 @ PostMapping ("create" )
37- public String processCreateEventForm (@ RequestParam String eventName ) {
38- events .add (new Event (eventName ));
37+ public String processCreateEventForm (@ RequestParam String eventName ,
38+ @ RequestParam String eventDescription ) {
39+ events .add (new Event (eventName , eventDescription ));
3940 return "redirect:/events" ;
4041 }
4142
Original file line number Diff line number Diff line change 11package org .launchcode .codingevents .models ;
22
3+ import java .util .Objects ;
4+
35/**
46 * Created by Chris Bay
57 */
68public class Event {
79
810 private String name ;
11+ private String description ;
912
10- public Event (String name ) {
13+ public Event (String name , String description ) {
1114 this .name = name ;
15+ this .description = description ;
1216 }
1317
1418 public String getName () {
@@ -19,6 +23,14 @@ public void setName(String name) {
1923 this .name = name ;
2024 }
2125
26+ public String getDescription () {
27+ return description ;
28+ }
29+
30+ public void setDescription (String description ) {
31+ this .description = description ;
32+ }
33+
2234 @ Override
2335 public String toString () {
2436 return name ;
Original file line number Diff line number Diff line change 55
66< header th:replace ="fragments :: header "> </ header >
77
8+
89< form method ="post ">
910 < div class ="form-group ">
10- < label > Name
11+ < label > Name
1112 < input type ="text " name ="eventName " class ="form-control ">
1213 </ label >
1314 </ div >
14- < br >
15+ < div class ="form-group ">
16+ < label > Description
17+ < input type ="text " name ="eventDescription " class ="form-control ">
18+ </ label >
19+ </ div >
1520 < div class ="form-group ">
1621 < input type ="submit " value ="Create " class ="btn btn-success ">
1722 </ div >
Original file line number Diff line number Diff line change 77
88< table class ="table table-striped ">
99 < thead >
10- < tr >
11- < th > Name</ th >
12- </ tr >
10+ < tr >
11+ < th > Name</ th >
12+ < th > Description</ th >
13+ </ tr >
1314 </ thead >
1415 < tr th:each ="event : ${events} ">
1516 < td th:text ="${event.name} "> </ td >
17+ < td th:text ="${event.description} "> </ td >
1618 </ tr >
1719</ table >
1820
You can’t perform that action at this time.
0 commit comments