0

So I have this code snippet in spring mvc

<a class="nav-item is-hidden-mobile is-active roboto strong letter-space-1" href="">HOME</a>
<a class="nav-item is-hidden-mobile roboto strong letter-space-1" href="about.jsp"> ABOUT </a>
<a class="nav-item is-hidden-mobile roboto strong letter-space-1" href=""> CONTACT </a>

But when I click on the ABOUTon my landing page, it won't redirect, instead it displays error code 404. Are there other things to fix before I can redirect there, besides in the html file?

Ank
  • 1,864
  • 4
  • 31
  • 51

1 Answers1

0

Try to create an endpoint in Controller that will return your about.jsp on some URL like that:

@Controller
public class HelloController {
   @RequestMapping("/hello-about")
   public String getHelloAbout(ModelMap model) {
      return "/WEB-INF/jsp/about.jsp";
   }
}

And change your link to point not to the about.jsp file but to the endpoint "/hello-about".

<a class="nav-item is-hidden-mobile roboto strong letter-space-1" href="/hello-about"> ABOUT </a>
Andrii Bugai
  • 156
  • 4