I have a folder in Spring MVC src/main/webapp/WEB-INF/views
that contains my view templates. I want to move it to src/main/java/views
(or some other folder outside of src/main/webapp
). How do I configure that in Spring MVC?
I see a file src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
that contains
<beans:property name="prefix" value="/WEB-INF/views/" />
It's obvious from looking at that that I can change it to
<beans:property name="prefix" value="/views/" />
which would put my views in src/main/webapp/views
, but I don't see any way to move views
out of the src/webapp
folder.
In other words, it's ultra clear that value="/"
is equivalent to src/main/webapp/
, so it seems like I'm limited to putting my view folder inside src/main/webapp.
How in the world do I set my view folder to be outside of src/main/webapp
, for example in src/main/foobar
!?! No matter what I search on Google/Bing I can't find anything.
EDIT: I tried to use the /../
to achieve it:
<beans:property name="prefix" value="/../java/edu/csus/csc191/views/" />
but that results in a error that says
SEVERE: Servlet.service() for servlet [appServlet] in context with path [/hp-dsat] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template "v2_upload", template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause
The said template does exist in src/main/webapp/../java/views
which is equivalent to src/main/java/views