vendredi 26 juillet 2019

an issue with a href in spring boot

I was trying to use a href to turn over the html pages.I searched the necessary codes to use,however I am getting the strange link when I click the button. http://localhost:8080/@%7Bindex%7D this link has been displayed when I wanted to open index page.However,it is working when I write the link manually like this : http://localhost:8080/index

Here is what I actually tried

HomeController.java

package io.javabrains;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class HomeController {

    @GetMapping("/index")
    public String index() {
        return "index";
    }

    @GetMapping("/tables")
    public String tables() {
        return "tables";
    }

}

index.html

<hr class="sidebar-divider my-0">

      <!-- Nav Item - Dashboard -->
      <li class="nav-item">

<a class="nav-link" href="@{index}">

<i class="fas fa-fw fa-tachometer-alt"></i>
          <span>Dashboard</span></a>
      </li>

      <!-- Divider -->
      <hr class="sidebar-divider">

      <!-- Heading -->
      <div class="sidebar-heading">
        Interface
      </div>




Aucun commentaire:

Enregistrer un commentaire