File tree Expand file tree Collapse file tree
java/org/launchcode/codingeventsv3/controllers
resources/templates/events Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import org .launchcode .codingeventsv3 .models .Event ;
55import org .springframework .stereotype .Controller ;
66import org .springframework .ui .Model ;
7- import org .springframework .web .bind .annotation .GetMapping ;
8- import org .springframework .web .bind .annotation .PostMapping ;
9- import org .springframework .web .bind .annotation .RequestMapping ;
10- import org .springframework .web .bind .annotation .RequestParam ;
7+ import org .springframework .web .bind .annotation .*;
118
129import java .util .ArrayList ;
1310import java .util .List ;
@@ -30,8 +27,8 @@ public String renderEventForm() {
3027
3128
3229 @ PostMapping ("create" )
33- public String createEventHandler (@ RequestParam String eventName , @ RequestParam String eventDescription ) {
34- EventData .add (new Event ( eventName , eventDescription ) );
30+ public String createEventHandler (@ ModelAttribute Event newEvent ) {
31+ EventData .add (newEvent );
3532 return "redirect:/events" ;
3633 }
3734
Original file line number Diff line number Diff line change @@ -10,15 +10,15 @@ <h1>Create Event</h1>
1010 < div class ="form-group ">
1111 < label > Name</ label >
1212
13- < input type ="text " name ="eventName " class ="form-control ">
13+ < input type ="text " name ="name " class ="form-control ">
1414
1515 </ div >
1616
1717 < div class ="form-group ">
1818
1919 < label > Description</ label >
2020
21- < input type ="text " name ="eventDescription " class ="form-control ">
21+ < input type ="text " name ="description " class ="form-control ">
2222 </ div >
2323
2424 < div class ="form-group ">
You can’t perform that action at this time.
0 commit comments