| org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView org.springframework.web.servlet.view.jasperreports.JasperReportsMultiFormatView
JasperReportsMultiFormatView | public class JasperReportsMultiFormatView extends AbstractJasperReportsView (Code) | | 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 :
Map model = new HashMap();
model.put("format", "pdf");
Here 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.
author: Rob Harrop author: Juergen Hoeller since: 1.1.5 See Also: JasperReportsMultiFormatView.setFormatKey See Also: JasperReportsMultiFormatView.setFormatMappings |
Constructor Summary | |
public | JasperReportsMultiFormatView() Creates a new JasperReportsMultiFormatView instance
with a default set of mappings. |
DEFAULT_FORMAT_KEY | final public static String DEFAULT_FORMAT_KEY(Code) | | Default value used for format key: "format"
|
JasperReportsMultiFormatView | public JasperReportsMultiFormatView()(Code) | | Creates a new JasperReportsMultiFormatView instance
with a default set of mappings.
|
getContentDispositionMappings | public Properties getContentDispositionMappings()(Code) | | Return the mappings of Content-Disposition header values to
mapping keys. Mainly available for configuration through property paths
that specify individual keys.
|
renderReport | protected void renderReport(JasperPrint populatedReport, Map model, HttpServletResponse response) throws Exception(Code) | | 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.
|
setContentDispositionMappings | public void setContentDispositionMappings(Properties mappings)(Code) | | 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.
|
setFormatKey | public void setFormatKey(String formatKey)(Code) | | Set the key of the model parameter that holds the format discriminator.
Default is "format".
|
setFormatMappings | public void setFormatMappings(Properties mappingsWithClassNames)(Code) | | Set the mappings of format discriminators to view class names.
The default mappings are:
csv - JasperReportsCsvView
html - JasperReportsHtmlView
pdf - JasperReportsPdfView
xls - JasperReportsXlsView
|
Fields inherited from org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView | final protected static String CONTENT_DISPOSITION_INLINE(Code)(Java Doc) final protected static String HEADER_CONTENT_DISPOSITION(Code)(Java Doc)
|
|
|