java.lang.Object | ||||||
↳ | org.springframework.context.support.ApplicationObjectSupport | |||||
↳ | org.springframework.web.context.support.WebApplicationObjectSupport | |||||
↳ | org.springframework.web.servlet.view.AbstractView | |||||
↳ | org.springframework.web.servlet.view.AbstractUrlBasedView | |||||
↳ | org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView | |||||
↳ | org.springframework.web.servlet.view.jasperreports.JasperReportsMultiFormatView |
Jasper Reports view class that allows for the actual rendering format to be specified at runtime using a parameter contained in the model.
This view works on the concept of a format key and a mapping key.
The format key is used to pass the mapping key from your
Controller
to Spring through as part of the model and the
mapping key is used to map a logical format to an actual JasperReports
view class. For example you might add the following code to your
Controller
:
MapHeremodel = new HashMap (); model.put("format", "pdf");
format
is the format key and pdf
is
the mapping key. When rendering a report, this class looks for a
model parameter under the format key, which by default is
format
. It then uses the value of this parameter to lookup
the actual View
class to use. The default mappings for this
lookup are:
csv
- JasperReportsCsvView
html
- JasperReportsHtmlView
pdf
- JasperReportsPdfView
xls
- JasperReportsXlsView
The format key can be changed using the formatKey
property and the mapping key to view class mappings can be changed using the
formatMappings
property.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DEFAULT_FORMAT_KEY | Default value used for format key: "format" |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView
| |||||||||||
From class
org.springframework.web.servlet.view.AbstractView
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.context.support.ApplicationObjectSupport
| |||||||||||
From interface
org.springframework.web.servlet.View
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
JasperReportsMultiFormatView instance
with a default set of mappings. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the mappings of
Content-Disposition header values to
mapping keys. | |||||||||||
Set the mappings of
Content-Disposition header values to
mapping keys. | |||||||||||
Set the key of the model parameter that holds the format discriminator.
| |||||||||||
Set the mappings of format discriminators to view class names.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return whether this view generates download content
(typically binary content like PDF or Excel files).
| |||||||||||
Locates the format key in the model using the configured discriminator key and uses this
key to lookup the appropriate view class from the mappings.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView
| |||||||||||
From class
org.springframework.web.servlet.view.AbstractUrlBasedView
| |||||||||||
From class
org.springframework.web.servlet.view.AbstractView
| |||||||||||
From class
org.springframework.web.context.support.WebApplicationObjectSupport
| |||||||||||
From class
org.springframework.context.support.ApplicationObjectSupport
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.BeanNameAware
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
| |||||||||||
From interface
org.springframework.context.ApplicationContextAware
| |||||||||||
From interface
org.springframework.web.context.ServletContextAware
| |||||||||||
From interface
org.springframework.web.servlet.View
|
Default value used for format key: "format"
Creates a new JasperReportsMultiFormatView
instance
with a default set of mappings.
Return the mappings of Content-Disposition
header values to
mapping keys. Mainly available for configuration through property paths
that specify individual keys.
Set the mappings of Content-Disposition
header values to
mapping keys. If specified, Spring will look at these mappings to determine
the value of the Content-Disposition
header for a given
format mapping.
Set the key of the model parameter that holds the format discriminator. Default is "format".
Set the mappings of format discriminators to view class names. The default mappings are:
csv
- JasperReportsCsvView
html
- JasperReportsHtmlView
pdf
- JasperReportsPdfView
xls
- JasperReportsXlsView
Return whether this view generates download content (typically binary content like PDF or Excel files).
The default implementation returns false
. Subclasses are
encouraged to return true
here if they know that they are
generating download content that requires temporary caching on the
client side, typically via the response OutputStream.
Locates the format key in the model using the configured discriminator key and uses this key to lookup the appropriate view class from the mappings. The rendering of the report is then delegated to an instance of that view class.
populatedReport | the populated JasperPrint to render |
---|---|
model | the map containing report parameters |
response | the HTTP response the report should be rendered to |
Exception |
---|