spring-framework / org.springframework.web.servlet.view / DefaultRequestToViewNameTranslator / <init>

<init>

DefaultRequestToViewNameTranslator()

RequestToViewNameTranslator that simply transforms the URI of the incoming request into a view name.

Can be explicitly defined as the viewNameTranslator bean in a org.springframework.web.servlet.DispatcherServlet context. Otherwise, a plain default instance will be used.

The default transformation simply strips leading and trailing slashes as well as the file extension of the URI, and returns the result as the view name with the configured prefix and a suffix added as appropriate.

The stripping of the leading slash and file extension can be disabled using the stripLeadingSlash and stripExtension properties, respectively.

Find below some examples of request to view name translation.

Author
Rob Harrop

Author
Juergen Hoeller

Since
2.0

See Also
org.springframework.web.servlet.RequestToViewNameTranslatororg.springframework.web.servlet.ViewResolver