What is a View and what’s the idea behind supporting different types of View?

Technology CommunityCategory: SpringWhat is a View and what’s the idea behind supporting different types of View?
VietMX Staff asked 3 years ago

View is an interface in Spring MVC application whose implementations are responsible for rendering context and exposing the model. A single view exposes multiple model attributes. Views in Spring MVC can be beans.

They are likely to be instantiated as beans by a ViewResolver. As this interface is stateless, view implementations should be thread-safe. By using ViewResolver, a logical name of view can be resolved into different types of View implementation, e.g. JstlView for displaying JSP or other view implementations for FreeMarker and Velocity.