How does Spring MVC identify Model, View and Controller files?

Asked

Viewed 86 times

0

I wanted to know how Spring tracks these files. So far I know that Spring MVC has the DispatcherServlet that is responsible for sending the requests to the controllers that respond to such URL. But how does Spring return/render the correct page (View)? Where is recorded their location?

I’ve seen on some Github projects that devs declare on a .xml one InternalResourceViewResolver with a prefix and a suffix, but when I fetch this prefix (the supposed directory) has no View file, they are either a directory above, or elsewhere.

1 answer

0

The prefix and suffix of the files that will be observed may be in Properties as well:

spring.mvc.view.prefix= # Spring MVC view prefix.
spring.mvc.view.suffix= # Spring MVC view suffix.

In addition, if you are in a Maven project, it is customary that by default the files are in "/src/main/webapp..."

If I could post more information about your project, it would help us..

Browser other questions tagged

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