Commit 634f9a9c by Patryk Czarnik

Rozmowa - ramka ze stylem i ify

parent a1735cf4
...@@ -10,7 +10,9 @@ public class RozmowaController { ...@@ -10,7 +10,9 @@ public class RozmowaController {
@RequestMapping("/rozmowa") @RequestMapping("/rozmowa")
public String rozmowa(String imie, Model model) { public String rozmowa(String imie, Model model) {
System.out.println("Przysłane imię: " + imie); System.out.println("Przysłane imię: " + imie);
model.addAttribute("powitanie", "Witaj " + imie); if(imie != null && !imie.isEmpty()) {
model.addAttribute("powitanie", "Witaj " + imie);
}
return "rozmowa.html"; return "rozmowa.html";
} }
......
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
<button>OK</button> <button>OK</button>
</form> </form>
<p th:text="${powitanie}">Lorem ipsum</p> <div class="wynik"
th:if="${powitanie != null}"
th:text="${powitanie}">Lorem ipsum</div>
</body> </body>
</html> </html>
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