File tree Expand file tree Collapse file tree
java/org/launchcode/codingevents/controllers
resources/templates/events Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import org .launchcode .codingevents .data .EventData ;
44import org .launchcode .codingevents .models .Event ;
55import org .springframework .stereotype .Controller ;
6- import org .springframework .web .bind .annotation .GetMapping ;
7- import org .springframework .web .bind .annotation .PostMapping ;
8- import org .springframework .web .bind .annotation .RequestMapping ;
6+ import org .springframework .web .bind .annotation .*;
97import org .springframework .ui .Model ;
10- import org .springframework .web .bind .annotation .RequestParam ;
118
129import java .util .ArrayList ;
1310import java .util .List ;
@@ -33,9 +30,8 @@ public String displayCreateEventForm(Model model) {
3330 }
3431
3532 @ PostMapping ("create" )
36- public String processCreateEventForm (@ RequestParam String eventName ,
37- @ RequestParam String eventDescription ) {
38- EventData .add (new Event (eventName , eventDescription ));
33+ public String processCreateEventForm (@ ModelAttribute Event newEvent ) {
34+ EventData .add (newEvent );
3935 return "redirect:/events" ;
4036 }
4137
Original file line number Diff line number Diff line change 88< form method ="post ">
99 < div class ="form-group ">
1010 < label > Name
11- < input type ="text " name ="eventName " class ="form-control ">
11+ < input type ="text " name ="name " class ="form-control ">
1212 </ label >
1313 </ div >
1414 < div class ="form-group ">
1515 < label > Description
16- < input type ="text " name ="eventDescription " class ="form-control ">
16+ < input type ="text " name ="description " class ="form-control ">
1717 </ label >
1818 </ div >
1919 < div class ="form-group ">
You can’t perform that action at this time.
0 commit comments