Commit 0f9ff0c1 by Patryk Czarnik

Wypisywanie błędów SQL w razie wystąpienia

parent 2adddba3
...@@ -90,8 +90,12 @@ public class ProductController { ...@@ -90,8 +90,12 @@ public class ProductController {
// Spring sam wpisze dane do pól o takich samych nazwach. // Spring sam wpisze dane do pól o takich samych nazwach.
// Taki parametr od razu staje się częścią modelu (to jest tzw. ModelAttribute) // Taki parametr od razu staje się częścią modelu (to jest tzw. ModelAttribute)
// i nie trzeba dodawać go w osobnym poleceniu. // i nie trzeba dodawać go w osobnym poleceniu.
try {
productRepository.save(product); productRepository.save(product);
model.addAttribute("saved", true);
} catch(Exception e) {
model.addAttribute("errors", List.of(e.toString()));
}
return "product_form"; return "product_form";
} }
......
...@@ -46,7 +46,7 @@ h2, h3, h4 { ...@@ -46,7 +46,7 @@ h2, h3, h4 {
.error { .error {
color: red; color: red;
border: 4px solid red; border: 4px solid red;
margin: 1em 0; margin: 1em 400px 1em 50px;
padding: 1em; padding: 1em;
background-color: white; background-color: white;
font-weight: bold; font-weight: bold;
...@@ -55,7 +55,7 @@ h2, h3, h4 { ...@@ -55,7 +55,7 @@ h2, h3, h4 {
.info { .info {
color: green; color: green;
border: 4px solid green; border: 4px solid green;
margin: 1em 0; margin: 1em 400px 1em 50px;
padding: 1em; padding: 1em;
background-color: white; background-color: white;
font-weight: bold; font-weight: bold;
......
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