Skip to content

Commit 8219dea

Browse files
committed
starter code
1 parent ba91d2a commit 8219dea

4 files changed

Lines changed: 82 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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>

0 commit comments

Comments
 (0)