Interface FragmentsRendering
Public API for HTML rendering of a collection of fragments each with a view
 and independent model. For use with frontends technologies such as
 htmx where multiple page fragments may be
 rendered in one response. Supported as a return value from Spring MVC
 controller methods.
- Since:
- 6.2
- Author:
- Rossen Stoyanchev
- 
Nested Class SummaryNested Classes
- 
Field SummaryFields inherited from interface org.springframework.web.servlet.ViewPATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
- 
Method SummaryModifier and TypeMethodDescriptionheaders()Return headers to add to the response.status()Return the HTTP status to set the response to.static FragmentsRendering.BuilderVariant ofwith(String, Map)with a view name only, but also inheriting model attributes from the shared model for the request.static FragmentsRendering.BuilderCreate a builder and add a fragment with a view name and a model.static FragmentsRendering.Builderwith(Collection<ModelAndView> fragments) Variant ofwith(String, Map)with a collection of fragments.Methods inherited from interface org.springframework.web.servlet.SmartViewisRedirectView, resolveNestedViewsMethods inherited from interface org.springframework.web.servlet.ViewgetContentType, render
- 
Method Details- 
statusReturn the HTTP status to set the response to.
- 
headersHttpHeaders headers()Return headers to add to the response.
- 
withCreate a builder and add a fragment with a view name and a model.- Parameters:
- viewName- the name of the view for the fragment
- model- attributes for the fragment in addition to model attributes inherited from the shared model for the request
- Returns:
- the created builder
 
- 
withVariant ofwith(String, Map)with a view name only, but also inheriting model attributes from the shared model for the request.- Parameters:
- viewName- the name of the view for the fragment
- Returns:
- the created builder
 
- 
withVariant ofwith(String, Map)with a collection of fragments.- Parameters:
- fragments- the fragments to add; each fragment also inherits model attributes from the shared model for the request
- Returns:
- the created builder
 
 
-