normin48
normin48

Reputation: 15

Thymeleaf Open new html file

I didnt open new html file when onclick on button

<!DOCTYPE html>
<html xmlns:th="http://thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>Sign up Page</title>
</head>
<body>
<h1>Welcome to Getir Library</h1>
<br>
<hr>
<form th:action="@{/Main}" method="post">
  <div class = "header">
    <h1>Menu</h1>
    <button type="submit" th:onclick="|window.location.href='/CustomerLogin'|" >Customer Login Page</button>

Also This is my Controller Class.

@RequestMapping(value = "/CustomerLogin")
    String getCustomerLoginPage(){
        return "CustomerLogin";
    }

[![enter image description here][1]][1]

This is my html files in the javaspring project [1]: https://i.sstatic.net/iv7aq.png

Upvotes: 0

Views: 128

Answers (2)

Kaushal
Kaushal

Reputation: 69

Try this

<!DOCTYPE html>
<html xmlns:th="http://thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>Sign up Page</title>
</head>
<body>
<h1>Welcome to Getir Library</h1>
<br>
<hr>
<form th:action="@{/Main}" method="post">
  <div class = "header">
    <h1>Menu</h1>
    <button type="button" th:onclick="|window.location.href='/CustomerLogin'|" >Customer Login Page</button>

Upvotes: 1

normin48
normin48

Reputation: 15

<Button type must button not submit and try again

Upvotes: 0

Related Questions