File tree Expand file tree Collapse file tree
java/org/launchcode/codingevents/controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org .launchcode .codingevents .controllers ;
2+
3+ import org .springframework .stereotype .Controller ;
4+ import org .springframework .web .bind .annotation .GetMapping ;
5+ import org .springframework .web .bind .annotation .RequestMapping ;
6+ import org .springframework .ui .Model ;
7+
8+ import java .util .ArrayList ;
9+ import java .util .List ;
10+
11+ /**
12+ * Created by Chris Bay
13+ */
14+ @ Controller
15+ @ RequestMapping ("events" )
16+ public class EventController {
17+
18+ @ GetMapping
19+ public String displayAllEvents (Model model ) {
20+ List <String > events = new ArrayList <>();
21+ events .add ("Code With Pride" );
22+ events .add ("Strange Loop" );
23+ events .add ("Apple WWDC" );
24+ events .add ("SpringOne Platform" );
25+ model .addAttribute ("events" , events );
26+ return "events/index" ;
27+ }
28+
29+ }
Original file line number Diff line number Diff line change 1+ package org .launchcode .codingevents .controllers ;
2+
3+ import org .springframework .stereotype .Controller ;
4+ import org .springframework .web .bind .annotation .GetMapping ;
5+
6+ /**
7+ * Created by Chris Bay
8+ */
9+ @ Controller
10+ public class HomeController {
11+
12+ @ GetMapping
13+ public String index () {
14+ return "index" ;
15+ }
16+
17+ }
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en " xmlns:th ="http://www.thymeleaf.org/ ">
3+ < head >
4+ < meta charset ="UTF-8 "/>
5+ < title > Coding Events</ title >
6+ </ head >
7+ < body >
8+
9+ < h1 > All Events</ h1 >
10+
11+ < ul >
12+ < th:block th:each ="event : ${events} ">
13+ < li th:text ="${event} "> </ li >
14+ </ th:block >
15+ </ ul >
16+
17+ </ body >
18+ </ html >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en " xmlns:th ="http://www.thymeleaf.org/ ">
3+ < head >
4+ < meta charset ="UTF-8 "/>
5+ < title > Coding Events</ title >
6+ </ head >
7+ < body >
8+
9+ < h1 > Coding Events</ h1 >
10+
11+ < nav >
12+ < ul >
13+ < li > < a href ="/events "> All Events</ a > </ li >
14+ </ ul >
15+ </ nav >
16+
17+ </ body >
18+ </ html >
You can’t perform that action at this time.
0 commit comments