Commit ab9ee12b by Patryk Czarnik

time5 - zrobione

parent f40ef742
package alx;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -53,8 +54,9 @@ public class TimeController {
}
@RequestMapping("/time5")
public String time5() {
public String time5(Model model) {
LocalDateTime dateTime = LocalDateTime.now();
model.addAttribute("dt", dateTime);
return "szablon5.html";
}
......
......@@ -7,6 +7,12 @@
<body>
<h1>Szablon 5</h1>
<p>Zaraz powiem, która godzina...</p>
<p>Bieżący czas: [[${dt}]]</p>
<ul>
<li>Rok: [[${dt.year}]]</li>
<li>Dzień roku: [[${dt.dayOfYear}]]</li>
<li>Dzień tygodnia: [[${dt.dayOfWeek}]]</li>
</ul>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment