M
M
Mad Moon2020-08-14 19:39:23
Java
Mad Moon, 2020-08-14 19:39:23

How to redirect to a page? Java Spring Boot?

After clicking on the login, we go to the authorization page, I have 5 tabs: Main, Main1, Main2, .. Main
5 e. Home
Below is the header code.

<li style="margin: 0 2.1rem;" class="nav-item login">
                <a class="nav-link " th:href="@{/login}" onclick="document.getElementById('login').style.display='flex'">
                    Логин
                </a>
                <hr>
                <a class="nav-link " th:href="@{/registration}" onclick="document.getElementById('register').style.display='flex'">
                    Регистрация
                </a>

            </li>


Authorization itself

<form th:action="@{/login}" method="post">
                <div th:if="${param.error}">
                    <div class="alert alert-danger">Invalid username or
                        password.</div>
                </div>
                <div th:if="${param.logout}">
                    <div class="alert alert-info">You have been logged out.</div>
                </div>
                <div class = "form-group">
                    <label for ="username"> Username </label> :
                    <input type="text" class = "form-control" id ="username" name = "username"
                           placeholder="Enter Email ID" autofocus="autofocus">
                </div>
                <div class="form-group">
                    <label for="password">Password</label>: <input type="password"
                                                                   id="password" name="password" class="form-control"
                                                                   placeholder="Enter Password" />
                </div>

                <div class="form-group">
                    <div class="row">
                        <div class="col-sm-6 col-sm-offset-3">
                            <input type="submit" name="login-submit" id="login-submit"
                                   class="form-control btn btn-primary" value="Log In" />
                        </div>
                    </div>
                </div>
            </form>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2020-08-14
Hasanly @azerphoenix

Hello!
The answer to your question is easy enough to find on the internet if you google...
https://stackoverflow.com/questions/26833452/sprin...
https://stackoverflow.com/questions/14573654/sprin...
https:/ /www.baeldung.com/spring-security-redirect-login

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question