Simple implementation of the {@link org.springframework.web.servlet.ViewResolver}interface, allowing for direct resolution of symbolic view names to URLs, without explicit mapping definition. This is useful if your symbolic names match the names of your view resources in a straightforward manner (i.e. the symbolic name is the unique part of the resource's filename), without the need for a dedicated mapping to be defined for each view.
Supports {@link AbstractUrlBasedView} subclasses like {@link InternalResourceView}, {@link org.springframework.web.servlet.view.velocity.VelocityView} and{@link org.springframework.web.servlet.view.freemarker.FreeMarkerView}. The view class for all views generated by this resolver can be specified via the "viewClass" property.
View names can either be resource URLs themselves, or get augmented by a specified prefix and/or suffix. Exporting an attribute that holds the RequestContext to all views is explicitly supported.
Example: prefix="/WEB-INF/jsp/", suffix=".jsp", viewname="test" -> "/WEB-INF/jsp/test.jsp"
As a special feature, redirect URLs can be specified via the "redirect:" prefix. E.g.: "redirect:myAction.do" will trigger a redirect to the given URL, rather than resolution as standard view name. This is typically used for redirecting to a controller URL after finishing a form workflow.
Furthermore, forward URLs can be specified via the "forward:" prefix. E.g.: "forward:myAction.do" will trigger a forward to the given URL, rather than resolution as standard view name. This is typically used for controller URLs; it is not supposed to be used for JSP URLs - use logical view names there.
Note: This class does not support localized resolution, i.e. resolving a symbolic view name to different resources depending on the current locale.
Note: When chaining ViewResolvers, a UrlBasedViewResolver will check whether the {@link AbstractUrlBasedView#checkResource specified resource actually exists}. However, with {@link InternalResourceView}, it is not generally possible to determine the existence of the target resource upfront. In such a scenario, a UrlBasedViewResolver will always return View for any given view name; as a consequence, it should be configured as the last ViewResolver in the chain.
@author Juergen Hoeller
@author Rob Harrop
@since 13.12.2003
@see #setViewClass
@see #setPrefix
@see #setSuffix
@see #setRequestContextAttribute
@see #REDIRECT_URL_PREFIX
@see AbstractUrlBasedView
@see InternalResourceView
@see org.springframework.web.servlet.view.velocity.VelocityView
@see org.springframework.web.servlet.view.freemarker.FreeMarkerView