@PostMapping("/sketches/add")
public String addSketch(
@Valid Sketch sketch,
BindingResult result,
RedirectAttributes redirectAttributes) {
redirectAttributes.addFlashAttribute("action", "save");
if (result.hasErrors()) {
return "admin/add-sketch";
}
sketchRepository.save(sketch);
return "redirect:/admin/sketches/add";
}
<link rel="stylesheet" th:href="@{/libs/toastr/toastr.min.css}">
<script th:src="@{/libs/jquery/jquery-3.4.1.min.js}"></script>
<script defer th:src="@{/libs/toastr/toastr.min.js}"></script>
<script defer th:src="@{/js/add-sketch.js}"></script>
/*TOASTR OPTIONS*/
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-bottom-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "2000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
<script th:inline="javascript">
$(document).ready(function () {
var action = [[${action}]];
if (action === 'save') {
toastr["success"]("Success!")
}
});
</script>
@GetMapping("/home")
public String home() {
return "home";
}
@GetMapping("/")
public String homePage() {
return "forward:/home";
}
<ul class="header-links">
<li th:class="${#httpServletRequest.requestURI.contains('/home')} ? 'link-active' : 'link-inactive'"><a th:href="@{/home}">Home</a></li>
<li><a href="https://github.com/tttapa/Control-Surface" target="_blank">Get Library<i class="fab fa-github"></i></a></li>
<li th:class="${#httpServletRequest.requestURI.contains('/examples')} ? 'link-active' : 'link-inactive'"><a th:href="@{/examples}">Sketch Examples</a></li>
<li th:class="${#httpServletRequest.requestURI.contains('/tutorials')} ? 'link-active' : 'link-inactive'"><a th:href="@{/tutorials}">Video Tutorials</a></li>
</ul>
"C:\\Temp\\your directory"
UPDATE category1 SET ID = rowid;
vacuum;
<TextBox x:Name="CategoryText"
TextChanged="ChangeText"
Style="{StaticResource CategoryTextBox}" />
public partial class FontWindow : Window
{
private MainWindow window;
public FontWindow(MainWindow mainWindow)
{
InitializeComponent();
window = mainWindow;
}
private void ChangeText(object sender, TextChangedEventArgs e)
{
TextBox tb = sender as TextBox;
window.CategoryLabel1.Content = tb.Text;
}
}
<table class="table table-bordered table-dark">
</thead>
<tbody>
<tr>
<th scope="col" >ID</th>
<th scope="col">First Name</th>
<th scope="col">Last Name</th>
<th scope="col">Gender</th>
<th scope="col">Email</th>
<th scope="col">Section</th>
<th scope="col">Country</th>
<th scope="col">Edit</th>
<th scope="col">Delete</th>
</tr>
<tr th:each="student, iStat : ${list}">
<td th:text="${iStat.index + 1}"></td>
<td th:text="${student.firstName}"></td>
<td th:text="${student.lastName}"></td>
<td th:text="${student.gender}"></td>
<td th:text="${student.email}"></td>
<td th:text="${student.section}"></td>
<td th:text="${student.country}"></td>
<td><a th:href="@{'/editstudent/' + ${student.id}}">Edit</a></td>
<td><a th:href="@{'/deletestudent/' + ${student.id}}">Delete</a></td>
</tr>
</tbody>
</table>
<tr th:each="student : ${list}">
<td th:text="${student.id}"></td>
<tr th:each="student, iStat : ${list}">
<td th:text="${iStat.index + 1}"></td>
private void readPropertiesFile() {
File file = new File("config.properties");
FileInputStream fileInput = new FileInputStream(file);
Properties properties = new Properties();
properties.load(fileInput);
fileInput.close();
String colorCategory1 = properties.getProperty("categoryColor1");
Color c1 = Color.web(colorCategory1);
Background bg1 = new Background(new BackgroundFill(c1, null, null));
category1.setBackground(bg1);
}