#8 -- Add router component. You can access to url's in mvc controllers also in web page templates.
parent
e348b37625
commit
33bf0bd8f3
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 Anton Romanov - All Rights Reserved
|
||||||
|
* You may use, distribute and modify this code, please write to: romanov73@gmail.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ru.ulstu.extractor.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class Route {
|
||||||
|
public static final String LIST_INDEXED_REPOSITORIES = "listRepositories";
|
||||||
|
public static final String LIST_REPOSITORY_BRANCHES = "listBranches";
|
||||||
|
public static final String INDEXING_NEW_REPOSITORY = "indexNewRepository";
|
||||||
|
public static final String FILTER_COMMITS = "filterCommits";
|
||||||
|
|
||||||
|
public static String getLIST_INDEXED_REPOSITORIES() {
|
||||||
|
return LIST_INDEXED_REPOSITORIES;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLIST_REPOSITORY_BRANCHES() {
|
||||||
|
return LIST_REPOSITORY_BRANCHES;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getINDEXING_NEW_REPOSITORY() {
|
||||||
|
return INDEXING_NEW_REPOSITORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getFILTER_COMMITS() {
|
||||||
|
return FILTER_COMMITS;
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +1,18 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2021 Anton Romanov - All Rights Reserved
|
||||||
|
~ You may use, distribute and modify this code, please write to: romanov73@gmail.com.
|
||||||
|
-->
|
||||||
|
|
||||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
||||||
<html xmlns:th="http://www.thymeleaf.org"
|
<html xmlns:th="http://www.thymeleaf.org"
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
layout:decorate="~{default}">
|
layout:decorate="~{default}">
|
||||||
<head>
|
<head>
|
||||||
<title>Простая обработка формы на Spring MVC</title>
|
<title>Фильтрация коммитов репозитория</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||||
</head>
|
</head>
|
||||||
<div class="container" layout:fragment="content">
|
<div class="container" layout:fragment="content">
|
||||||
<form action="#" th:action="@{/sendFilter}" th:object="${filterForm}" method="post">
|
<form action="#" th:action="${@route.FILTER_COMMITS}" th:object="${filterForm}" method="post">
|
||||||
<p><b>Фильтровать данные:</b><Br></p>
|
<p><b>Фильтровать данные:</b><Br></p>
|
||||||
По автору
|
По автору
|
||||||
<select class="selectpicker" data-live-search="true">
|
<select class="selectpicker" data-live-search="true">
|
@ -1,32 +0,0 @@
|
|||||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
|
||||||
<html xmlns:th="http://www.thymeleaf.org"
|
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
||||||
layout:decorate="~{default}">
|
|
||||||
<head>
|
|
||||||
<title>Простая обработка формы на Spring MVC</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
||||||
</head>
|
|
||||||
<div class="container" layout:fragment="content">
|
|
||||||
<h1>Форма</h1>
|
|
||||||
<form action="#" th:action="@{/sendEmail}" th:object="${emailForm}" method="post">
|
|
||||||
<p style="color:red" th:text="${error}"></p>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>Тема:</td>
|
|
||||||
<td><input type="text" th:field="*{subject}"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Кому:</td>
|
|
||||||
<td><input type="text" th:field="*{to}"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Сообщение:</td>
|
|
||||||
<td><textarea th:field="*{message}"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2"><input type="submit" value="Отправить"/></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
@ -1,18 +0,0 @@
|
|||||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
|
||||||
<html
|
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
||||||
layout:decorate="~{default}">
|
|
||||||
<head>
|
|
||||||
<title>Простая обработка формы на Spring MVC</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
||||||
</head>
|
|
||||||
<div class="container" layout:fragment="content">
|
|
||||||
<body>
|
|
||||||
<form oninput="result">
|
|
||||||
<p>Данные репозитория:</p>
|
|
||||||
<p>
|
|
||||||
<output name="result"></output>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue