Commit ab9ee12b by Patryk Czarnik

time5 - zrobione

parent f40ef742
package alx; package alx;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -53,8 +54,9 @@ public class TimeController { ...@@ -53,8 +54,9 @@ public class TimeController {
} }
@RequestMapping("/time5") @RequestMapping("/time5")
public String time5() { public String time5(Model model) {
LocalDateTime dateTime = LocalDateTime.now(); LocalDateTime dateTime = LocalDateTime.now();
model.addAttribute("dt", dateTime);
return "szablon5.html"; return "szablon5.html";
} }
......
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
<body> <body>
<h1>Szablon 5</h1> <h1>Szablon 5</h1>
<p>Zaraz powiem, która godzina...</p> <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> </body>
</html> </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