So I'm new to Spring and I've so far gotten a simple web API running connected to a MongoDB database, but I'm having trouble generating just plain old views using .jsp or .html files. I've tried a variety of different approaches: InternalResourceViewResolver
, XmlViewResolver
, returning Strings instead of ModelAndView
objects, nothing seems to be working for me. I have the following code:
Edit: here is a git repo with my project: https://github.com/jwallp/Spring-Test
As the above project is, I am getting a white label error upon going to /index
which says:
There was an unexpected error (type=Internal Server Error, status=500).
Circular view path [index]: would dispatch back to the current handler URL [/index] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
Edit: So I managed to get the view to finally load by using spring.view.prefix
and spring.view.suffix
instead of spring.mvc.view.prefix
and such, and by moving my WEB-INF
directory from my project root to inside <project root>/src/main/webapp/
. I just wanted to know, if my WEB-INF
directory is contained within another directory, will it still function as intended (making its contents not directly visible)?