I have generated some pages using Spring Roo, and I need to show some items from database on the homepage of the application. So how can I pass model with data to homepage, Roo has added following lines which I have commented out
<mvc:view-controller path="/" view-name="index"/>
I created a new controller using Roo called Home like this
@RequestMapping("/")
@Controller
public class Home {
@RequestMapping(method = RequestMethod.GET)
public String index() {
return "index";
}
}
Now all the pages show Index view, even /login .
Regards and thanks.
Try this:
Don't map to the "/" url, it will match all requests (as you have seen). Edit: According to comments, the highlighted part of the previous sentence is wrong. The workaround appears to still be valid.
@RequestMapping
of your index controller (perhaps "/index.html").Another option if that is not sufficient
@RequestMapping("/blammy")
).