Map Home Page Springmvc

Asked

Viewed 317 times

0

Hello!

I would like to map a home page using springmvc

I have this method: Man

Controller

public class Treinamento {
    @RequestMapping("/inicio")
    public String inicio(){
        return "index";
    }
}

in my

web xml.

<welcome-file-list>
        <welcome-file>inicio</welcome-file>
    </welcome-file-list>

How to map ?

1 answer

1


public class Treinamento {
    @RequestMapping("/")
    public String inicio(){
        return "redirect:index";
    }
}
  • but I’d like to call from the controller rs

  • You can map / and redirect to index in your controller then. ?

  • That’s right. It worked. Thanks and I just needed the Return "index"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.