This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch asf-staging
in repository https://gitbox.apache.org/repos/asf/struts-site.git
The following commit(s) were added to refs/heads/asf-staging by this push:
new 438d13076 Updates stage by Jenkins
438d13076 is described below
commit 438d13076c28073c54dcd3ef409e74d74815e394
Author: jenkins <[email protected]>
AuthorDate: Sat Sep 12 09:20:45 2026 +0000
Updates stage by Jenkins
---
content/plugins/index.html | 7 +-
content/plugins/jasperreports/index.html | 3 +-
content/plugins/jasperreports7/index.html | 428 ++++++++++++++++++++++++++++++
3 files changed, 436 insertions(+), 2 deletions(-)
diff --git a/content/plugins/index.html b/content/plugins/index.html
index bae10e288..473cd84af 100644
--- a/content/plugins/index.html
+++ b/content/plugins/index.html
@@ -215,7 +215,12 @@ to share with others. Several plugins are bundled with the
framework, and others
<tr>
<td><a href="jasperreports">JasperReports Plugin</a></td>
<td> </td>
- <td> </td>
+ <td>JasperReports 6.x</td>
+ </tr>
+ <tr>
+ <td><a href="jasperreports7">JasperReports 7 Plugin</a></td>
+ <td>7.1.0+</td>
+ <td>JasperReports 7.x</td>
</tr>
<tr>
<td><a href="java-8-support">Java 8 Support Plugin</a></td>
diff --git a/content/plugins/jasperreports/index.html
b/content/plugins/jasperreports/index.html
index b8adc4b51..f20759675 100644
--- a/content/plugins/jasperreports/index.html
+++ b/content/plugins/jasperreports/index.html
@@ -170,7 +170,8 @@
<p><a
href="http://jasperforge.org/sf/projects/jasperreports">JasperReports</a> is a
powerful open source Java (LGPL) reporting
tool that has the ability to deliver rich content onto the screen, to the
printer or into PDF, HTML, XLS, CSV and XML files.</p>
-<p>The JasperReports plugin enables Actions to create high-quality reports as
results.</p>
+<p>The JasperReports plugin enables Actions to create high-quality reports as
results. It targets the JasperReports 6.x
+line; for JasperReports 7.x use the <a href="../jasperreports7">JasperReports
7 Plugin</a> instead.</p>
<h2 id="features">Features</h2>
diff --git a/content/plugins/jasperreports7/index.html
b/content/plugins/jasperreports7/index.html
new file mode 100644
index 000000000..2a816a6c1
--- /dev/null
+++ b/content/plugins/jasperreports7/index.html
@@ -0,0 +1,428 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+ <meta name="Date-Revision-yyyymmdd" content="20140918"/>
+ <meta http-equiv="Content-Language" content="en"/>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+
+ <title>JasperReports 7 Plugin</title>
+
+ <link href="/css/source-sans-pro.css" rel="stylesheet" type="text/css">
+ <link href="/css/font-awesome.css" rel="stylesheet">
+ <link href="/css/main.css" rel="stylesheet">
+ <link href="/css/custom.css" rel="stylesheet">
+ <link href="/css/syntax.css" rel="stylesheet">
+
+ <script src="/js/jquery-1.11.0.min.js"></script>
+ <script type="text/javascript" src="/bootstrap/js/bootstrap.js"></script>
+ <script type="text/javascript" src="/js/community.js"></script>
+
+ <!-- Matomo -->
+ <script>
+ var _paq = window._paq = window._paq || [];
+ /* tracker methods like "setCustomDimension" should be called before
"trackPageView" */
+ /* We explicitly disable cookie tracking to avoid privacy issues */
+ _paq.push(['disableCookies']);
+ _paq.push(['trackPageView']);
+ _paq.push(['enableLinkTracking']);
+ (function() {
+ var u="//analytics.apache.org/";
+ _paq.push(['setTrackerUrl', u+'matomo.php']);
+ _paq.push(['setSiteId', '41']);
+ var d=document, g=d.createElement('script'),
s=d.getElementsByTagName('script')[0];
+ g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
+ })();
+ </script>
+ <!-- End Matomo Code -->
+</head>
+<body>
+
+<a href="https://github.com/apache/struts" class="github-ribbon">
+ <img decoding="async" loading="lazy" style="position: absolute; right: 0;
border: 0;" width="149" height="149"
src="/img/forkme_right_red_aa0000.webp?resize=149%2C149" class="attachment-full
size-full" alt="Fork me on GitHub" data-recalc-dims="1">
+</a>
+
+<header>
+ <nav>
+ <div role="navigation" class="navbar navbar-default navbar-fixed-top">
+ <div class="container">
+ <div class="navbar-header">
+ <button type="button" data-toggle="collapse"
data-target="#struts-menu" class="navbar-toggle">
+ Menu
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a href="/index.html" class="navbar-brand logo"><img
src="/img/struts-logo.svg"></a>
+ </div>
+ <div id="struts-menu" class="navbar-collapse collapse">
+ <ul class="nav navbar-nav">
+ <li class="dropdown">
+ <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+ Home<b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ <li><a href="/index.html">Welcome</a></li>
+ <li><a href="/download.cgi">Download</a></li>
+ <li><a href="/releases.html">Releases</a></li>
+ <li><a href="/announce-2026.html">Announcements</a></li>
+ <li><a href="http://www.apache.org/licenses/">License</a></li>
+ <li><a
href="https://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+ <li><a
href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+ <li><a
href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy
Policy</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+ Support<b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ <li><a href="/mail.html">User Mailing List</a></li>
+ <li><a href="https://issues.apache.org/jira/browse/WW">Issue
Tracker</a></li>
+ <li><a href="/security.html">Reporting Security Issues</a></li>
+ <li><a href="/commercial-support.html">Commercial
Support</a></li>
+ <li><a href="/eol-versions.html">End-of-Life Versions</a></li>
+ <li class="divider"></li>
+ <li><a
href="https://cwiki.apache.org/confluence/display/WW/Migration+Guide">Version
Notes</a></li>
+ <li><a
href="https://cwiki.apache.org/confluence/display/WW/Security+Bulletins">Security
Bulletins</a></li>
+ <li><a href="/idea-plugin">IntelliJ IDEA plugin</a></li>
+ <li class="divider"></li>
+ <li><a href="/maven/project-info.html">Maven Project
Info</a></li>
+ <li><a href="/maven/struts2-core/dependencies.html">Struts
Core Dependencies</a></li>
+ <li><a href="/maven/struts2-plugins/modules.html">Plugin
Dependencies</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+ Documentation<b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ <li><a href="/birdseye.html">Birds Eye</a></li>
+ <li><a href="/primer.html">Key Technologies</a></li>
+ <li><a href="/kickstart.html">Kickstart FAQ</a></li>
+ <li><a
href="https://cwiki.apache.org/confluence/display/WW/Home">Wiki</a></li>
+ <li class="divider"></li>
+ <li><a href="/getting-started/">Getting Started</a></li>
+ <li><a href="/security/">Security Guide</a></li>
+ <li><a href="/core-developers/">Core Developers Guide</a></li>
+ <li><a href="/tag-developers/">Tag Developers Guide</a></li>
+ <li><a href="/maven-archetypes/">Maven Archetypes</a></li>
+ <li><a href="/plugins/">Plugins</a></li>
+ <li><a href="/maven/struts2-core/apidocs/index.html">Struts
Core API</a></li>
+ <li><a href="/tag-developers/tag-reference.html">Tag
reference</a></li>
+ <li><a
href="https://cwiki.apache.org/confluence/display/WW/FAQs">FAQs</a></li>
+ <li><a
href="http://cwiki.apache.org/S2PLUGINS/home.html">Plugin registry</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+ Contributing<b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ <li><a href="/youatstruts.html">You at Struts</a></li>
+ <li><a href="/helping.html">How to Help FAQ</a></li>
+ <li><a href="/dev-mail.html">Development Lists</a></li>
+ <li class="divider"></li>
+ <li><a href="/submitting-patches.html">Submitting
patches</a></li>
+ <li><a href="/builds.html">Source Code and Builds</a></li>
+ <li><a href="/coding-standards.html">Coding standards</a></li>
+ <li><a href="/contributors/">Contributors Guide</a></li>
+ <li class="divider"></li>
+ <li><a href="/release-guidelines.html">Release
Guidelines</a></li>
+ <li><a href="/bylaws.html">PMC Charter</a></li>
+ <li><a href="/volunteers.html">Volunteers</a></li>
+ <li><a
href="https://gitbox.apache.org/repos/asf?p=struts.git">Source
Repository</a></li>
+ <li><a href="/updating-website.html">Updating the
website</a></li>
+ </ul>
+ </li>
+ <li class="apache"><a href="http://www.apache.org/"><img
src="/img/apache.png"></a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </nav>
+</header>
+
+
+<article class="container">
+ <section class="col-md-12">
+ <a class="edit-on-gh"
href="https://github.com/apache/struts-site/edit/main/source/plugins/jasperreports7/index.md"
title="Edit this page on GitHub">Edit on GitHub</a>
+
+ <a href="../" title="back to Plugins"><< back to Plugins</a>
+
+ <h1 class="no_toc" id="jasperreports-7-plugin">JasperReports 7 Plugin</h1>
+
+<ul id="markdown-toc">
+ <li><a href="#description" id="markdown-toc-description">Description</a></li>
+ <li><a href="#features" id="markdown-toc-features">Features</a></li>
+ <li><a href="#usage" id="markdown-toc-usage">Usage</a> <ul>
+ <li><a href="#examples" id="markdown-toc-examples">Examples</a></li>
+ <li><a href="#filling-from-report-parameters"
id="markdown-toc-filling-from-report-parameters">Filling from report
parameters</a></li>
+ <li><a href="#hooking-into-report-generation"
id="markdown-toc-hooking-into-report-generation">Hooking into report
generation</a></li>
+ <li><a href="#custom-exporters"
id="markdown-toc-custom-exporters">Custom exporters</a></li>
+ <li><a href="#settings" id="markdown-toc-settings">Settings</a></li>
+ <li><a href="#installation"
id="markdown-toc-installation">Installation</a></li>
+ </ul>
+ </li>
+ <li><a href="#migrating-from-the-jasperreports-plugin"
id="markdown-toc-migrating-from-the-jasperreports-plugin">Migrating from the
JasperReports plugin</a></li>
+</ul>
+
+<h2 id="description">Description</h2>
+<p><a
href="https://community.jaspersoft.com/project/jasperreports-library">JasperReports</a>
is a powerful open source Java (LGPL)
+reporting tool that has the ability to deliver rich content onto the screen,
to the printer or into PDF, HTML, XLSX,
+CSV, RTF and XML files.</p>
+
+<p>The JasperReports 7 plugin (<code class="language-plaintext
highlighter-rouge">struts2-jasperreports7-plugin</code>, since Struts 7.1.0)
enables Actions to create high-quality
+reports as results using the JasperReports 7.x line. Applications still on
JasperReports 6.x should use the
+<a href="../jasperreports">JasperReports Plugin</a> instead; the two plugins
are independent and are not meant to be used
+together.</p>
+
+<h2 id="features">Features</h2>
+
+<ul>
+ <li>Allows actions to be rendered through JasperReports 7.x</li>
+ <li>Exporters are pluggable: each output format is a <code
class="language-plaintext
highlighter-rouge">JasperReport7ExporterProvider</code> bean that can be
replaced or extended</li>
+</ul>
+
+<h2 id="usage">Usage</h2>
+
+<p>To use this plugin, have your packages that contain the target actions
extend the provided <code class="language-plaintext
highlighter-rouge">jasperreports7-default</code>
+package, which contains the <code class="language-plaintext
highlighter-rouge">jasperReport7</code> result type. Then, simply use the
result type in the desired actions.
+The result takes the following parameters:</p>
+
+<ul>
+ <li>location (default) - the location where the compiled jasper report
definition is (foo.jasper), relative from current URL</li>
+ <li>dataSource - the EL expression used to retrieve the datasource from the
value stack (usually a List). Since 7.4.0
+it is optional: when neither <code class="language-plaintext
highlighter-rouge">dataSource</code> nor <code class="language-plaintext
highlighter-rouge">connection</code> is set, the report is filled from its
parameters alone
+(see <a href="#filling-from-report-parameters">Filling from report
parameters</a>)</li>
+ <li>parse - <code class="language-plaintext highlighter-rouge">true</code>
by default, if set to false, the location param will not be parsed for EL
expressions</li>
+ <li>format - the format in which the report should be generated. Valid
values are the lower-case constants from
+<code class="language-plaintext
highlighter-rouge">JasperReport7Constants</code>: <code
class="language-plaintext highlighter-rouge">pdf</code>, <code
class="language-plaintext highlighter-rouge">xml</code>, <code
class="language-plaintext highlighter-rouge">html</code>, <code
class="language-plaintext highlighter-rouge">xlsx</code>, <code
class="language-plaintext highlighter-rouge">csv</code> and <code
class="language-plaintext highlighter-rouge">rtf</code>. The value selects the
expor [...]
+name, so it is case-sensitive. If no format is specified, <code
class="language-plaintext highlighter-rouge">pdf</code> will be used</li>
+ <li>contentDisposition - disposition (defaults to “inline”, values are
typically <code class="language-plaintext
highlighter-rouge">filename="document.pdf"</code>)</li>
+ <li>documentName - name of the document (will generate the http header <code
class="language-plaintext highlighter-rouge">Content-disposition = X;
filename=X.[format]</code>)</li>
+ <li>reportParameters - OGNL expression used to retrieve a map of report
parameters from the value stack.
+The parameters may be accessed in the report via the usual JR mechanism and
might include data not part of the
+dataSource, such as the user name of the report creator, etc.</li>
+ <li>connection - JDBC Connection which can be passed to the report instead
of dataSource</li>
+ <li>wrapField - defines if fields should wrap with ValueStackDataSource see
+<a href="https://issues.apache.org/jira/browse/WW-3698">WW-3698</a> for more
details</li>
+ <li>timeZone - ID of the time zone passed to the report as <code
class="language-plaintext highlighter-rouge">REPORT_TIME_ZONE</code>, e.g.
<code class="language-plaintext highlighter-rouge">Europe/Warsaw</code></li>
+</ul>
+
+<p>This result follows the same rules from <code class="language-plaintext
highlighter-rouge">StrutsResultSupport</code>. Specifically, all parameters
will be parsed
+if the “parse” parameter is not set to false.</p>
+
+<h3 id="examples">Examples</h3>
+
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><result</span> <span
class="na">name=</span><span class="s">"success"</span> <span
class="na">type=</span><span class="s">"jasperReport7"</span><span
class="nt">></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"location"</span><span class="nt">></span>foo.jasper<span
class="nt"></param></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"dataSource"</span><span class="nt">></span>mySource<span
class="nt"></param></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"format"</span><span class="nt">></span>csv<span
class="nt"></param></span>
+<span class="nt"></result></span>
+</code></pre></div></div>
+
+<p>or for pdf:</p>
+
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><result</span> <span
class="na">name=</span><span class="s">"success"</span> <span
class="na">type=</span><span class="s">"jasperReport7"</span><span
class="nt">></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"location"</span><span class="nt">></span>foo.jasper<span
class="nt"></param></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"dataSource"</span><span class="nt">></span>mySource<span
class="nt"></param></span>
+<span class="nt"></result></span>
+</code></pre></div></div>
+
+<h3 id="filling-from-report-parameters">Filling from report parameters</h3>
+
+<p>Since 7.4.0, when neither <code class="language-plaintext
highlighter-rouge">dataSource</code> nor <code class="language-plaintext
highlighter-rouge">connection</code> is set the result calls
+<code class="language-plaintext
highlighter-rouge">JasperFillManager.fillReport(report, parameters)</code> and
JasperReports resolves the data from the parameter map,
+exactly as it does when used standalone. Hand the object the report’s query
executer expects over via
+<code class="language-plaintext highlighter-rouge">reportParameters</code> - a
Hibernate <code class="language-plaintext highlighter-rouge">Session</code>
under <code class="language-plaintext
highlighter-rouge">HIBERNATE_SESSION</code>, a <code class="language-plaintext
highlighter-rouge">CSV_INPUT_STREAM</code>, a <code class="language-plaintext
highlighter-rouge">JSON_INPUT_STREAM</code>,
+or a ready <code class="language-plaintext
highlighter-rouge">REPORT_DATA_SOURCE</code> / <code class="language-plaintext
highlighter-rouge">REPORT_CONNECTION</code>. The report keeps its own <code
class="language-plaintext highlighter-rouge">queryString</code> (HQL, CSV,
JSON, …)
+and no intermediate <code class="language-plaintext
highlighter-rouge">List</code> has to be built in the action.</p>
+
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><result</span> <span
class="na">name=</span><span class="s">"success"</span> <span
class="na">type=</span><span class="s">"jasperReport7"</span><span
class="nt">></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"location"</span><span class="nt">></span>foo.jasper<span
class="nt"></param></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"reportParameters"</span><span
class="nt">></span>reportParameters<span class="nt"></param></span>
+<span class="nt"></result></span>
+</code></pre></div></div>
+
+<div class="language-java highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="kd">public</span> <span
class="nc">Map</span><span class="o"><</span><span
class="nc">String</span><span class="o">,</span> <span
class="nc">Object</span><span class="o">></span> <span
class="nf">getReportParameters</span><span class="o">()</span> <span
class="o">{</span>
+ <span class="k">return</span> <span class="nc">Map</span><span
class="o">.</span><span class="na">of</span><span class="o">(</span><span
class="s">"HIBERNATE_SESSION"</span><span class="o">,</span> <span
class="n">session</span><span class="o">);</span>
+<span class="o">}</span>
+</code></pre></div></div>
+
+<p>Query executers other than JDBC, CSV and XPath ship as separate
JasperReports artifacts (for example
+<code class="language-plaintext
highlighter-rouge">net.sf.jasperreports:jasperreports-hibernate</code>); add
the one your report needs to the application’s dependencies.
+When the parameter map carries nothing the executer can use, the outcome is
JasperReports’ own - it is not checked
+by the plugin.</p>
+
+<h3 id="hooking-into-report-generation">Hooking into report generation</h3>
+
+<p>An action can implement <code class="language-plaintext
highlighter-rouge">JasperReport7Aware</code> to take part in the report
lifecycle. All methods have default
+implementations, so override only what you need:</p>
+
+<ul>
+ <li><code class="language-plaintext
highlighter-rouge">beforeReportGeneration(ActionInvocation)</code> - called
before the report is filled</li>
+ <li><code class="language-plaintext
highlighter-rouge">afterReportGeneration(ActionInvocation, JasperReport)</code>
- called with the loaded report after it has been filled,
+before it is exported</li>
+ <li><code class="language-plaintext
highlighter-rouge">getCsvDelimiter(ActionInvocation)</code> - per-action CSV
delimiter; return <code class="language-plaintext
highlighter-rouge">null</code> to fall back to the global one
+(see <a href="#settings">Settings</a>)</li>
+ <li><code class="language-plaintext
highlighter-rouge">getReportLocale(ActionInvocation)</code> - locale passed to
the report as <code class="language-plaintext
highlighter-rouge">REPORT_LOCALE</code>; defaults to the locale
+of the current invocation</li>
+</ul>
+
+<div class="language-java highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="kd">public</span> <span
class="kd">class</span> <span class="nc">SalesReportAction</span> <span
class="kd">extends</span> <span class="nc">ActionSupport</span> <span
class="kd">implements</span> <span class="nc">JasperReport7Aware</span> <span
class="o">{</span>
+
+ <span class="nd">@Override</span>
+ <span class="kd">public</span> <span class="nc">String</span> <span
class="nf">getCsvDelimiter</span><span class="o">(</span><span
class="nc">ActionInvocation</span> <span class="n">invocation</span><span
class="o">)</span> <span class="o">{</span>
+ <span class="k">return</span> <span class="s">";"</span><span
class="o">;</span>
+ <span class="o">}</span>
+
+ <span class="nd">@Override</span>
+ <span class="kd">public</span> <span class="nc">Locale</span> <span
class="nf">getReportLocale</span><span class="o">(</span><span
class="nc">ActionInvocation</span> <span class="n">invocation</span><span
class="o">)</span> <span class="o">{</span>
+ <span class="k">return</span> <span class="nc">Locale</span><span
class="o">.</span><span class="na">GERMANY</span><span class="o">;</span>
+ <span class="o">}</span>
+<span class="o">}</span>
+</code></pre></div></div>
+
+<h3 id="custom-exporters">Custom exporters</h3>
+
+<p>Each format is served by a <code class="language-plaintext
highlighter-rouge">JasperReport7ExporterProvider</code> bean registered under
the format name (<code class="language-plaintext highlighter-rouge">pdf</code>,
<code class="language-plaintext highlighter-rouge">csv</code>,
+<code class="language-plaintext highlighter-rouge">html</code>, <code
class="language-plaintext highlighter-rouge">xlsx</code>, <code
class="language-plaintext highlighter-rouge">xml</code>, <code
class="language-plaintext highlighter-rouge">rtf</code>). To add a format the
plugin does not ship, implement the interface and register the
+bean under a new name in <code class="language-plaintext
highlighter-rouge">struts.xml</code>; that name is then a valid <code
class="language-plaintext highlighter-rouge">format</code> value. Bean names
must be unique, so a
+bundled exporter cannot be replaced this way - register it under a different
name, or override
+<code class="language-plaintext
highlighter-rouge">JasperReport7Result.exportReport</code> in a subclass.</p>
+
+<div class="language-java highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="kd">public</span> <span
class="kd">class</span> <span class="nc">DocxExporterProvider</span> <span
class="kd">implements</span> <span
class="nc">JasperReport7ExporterProvider</span><span class="o"><</span><span
class="nc">JRDocxExporter</span><span class="o">></span> <span
class="o">{</span>
+
+ <span class="nd">@Override</span>
+ <span class="kd">public</span> <span class="nc">JRDocxExporter</span>
<span class="nf">createExporter</span><span class="o">(</span><span
class="nc">ActionInvocation</span> <span class="n">invocation</span><span
class="o">,</span> <span class="nc">JasperPrint</span> <span
class="n">jasperPrint</span><span class="o">)</span> <span
class="kd">throws</span> <span class="nc">StrutsException</span> <span
class="o">{</span>
+ <span class="nc">HttpServletResponse</span> <span
class="n">response</span> <span class="o">=</span> <span
class="n">invocation</span><span class="o">.</span><span
class="na">getInvocationContext</span><span class="o">().</span><span
class="na">getServletResponse</span><span class="o">();</span>
+ <span class="n">response</span><span class="o">.</span><span
class="na">setContentType</span><span class="o">(</span><span
class="s">"application/vnd.openxmlformats-officedocument.wordprocessingml.document"</span><span
class="o">);</span>
+
+ <span class="nc">JRDocxExporter</span> <span class="n">exporter</span>
<span class="o">=</span> <span class="k">new</span> <span
class="nc">JRDocxExporter</span><span class="o">();</span>
+ <span class="n">exporter</span><span class="o">.</span><span
class="na">setExporterInput</span><span class="o">(</span><span
class="k">new</span> <span class="nc">SimpleExporterInput</span><span
class="o">(</span><span class="n">jasperPrint</span><span class="o">));</span>
+ <span class="k">try</span> <span class="o">{</span>
+ <span class="n">exporter</span><span class="o">.</span><span
class="na">setExporterOutput</span><span class="o">(</span><span
class="k">new</span> <span
class="nc">SimpleOutputStreamExporterOutput</span><span class="o">(</span><span
class="n">response</span><span class="o">.</span><span
class="na">getOutputStream</span><span class="o">()));</span>
+ <span class="o">}</span> <span class="k">catch</span> <span
class="o">(</span><span class="nc">IOException</span> <span
class="n">e</span><span class="o">)</span> <span class="o">{</span>
+ <span class="k">throw</span> <span class="k">new</span> <span
class="nf">StrutsException</span><span class="o">(</span><span
class="n">e</span><span class="o">);</span>
+ <span class="o">}</span>
+ <span class="k">return</span> <span class="n">exporter</span><span
class="o">;</span>
+ <span class="o">}</span>
+<span class="o">}</span>
+</code></pre></div></div>
+
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><bean</span> <span
class="na">name=</span><span class="s">"docx"</span>
+ <span class="na">class=</span><span
class="s">"com.example.DocxExporterProvider"</span>
+ <span class="na">type=</span><span
class="s">"org.apache.struts2.views.jasperreports7.export.JasperReport7ExporterProvider"</span><span
class="nt">/></span>
+</code></pre></div></div>
+
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><result</span> <span
class="na">name=</span><span class="s">"success"</span> <span
class="na">type=</span><span class="s">"jasperReport7"</span><span
class="nt">></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"location"</span><span class="nt">></span>foo.jasper<span
class="nt"></param></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"dataSource"</span><span class="nt">></span>mySource<span
class="nt"></param></span>
+ <span class="nt"><param</span> <span class="na">name=</span><span
class="s">"format"</span><span class="nt">></span>docx<span
class="nt"></param></span>
+<span class="nt"></result></span>
+</code></pre></div></div>
+
+<p>The provider is responsible for setting the response content type and
wiring the exporter output to the response
+stream; the result calls <code class="language-plaintext
highlighter-rouge">exportReport()</code> and flushes the response. The format
name is also used as the file
+extension when <code class="language-plaintext
highlighter-rouge">documentName</code> is set.</p>
+
+<h3 id="settings">Settings</h3>
+
+<table>
+ <thead>
+ <tr>
+ <th>Constant</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code class="language-plaintext
highlighter-rouge">struts.jasperReport7.csv.defaultDelimiter</code></td>
+ <td><code class="language-plaintext highlighter-rouge">,</code></td>
+ <td>field delimiter used by the CSV exporter</td>
+ </tr>
+ <tr>
+ <td><code class="language-plaintext
highlighter-rouge">struts.jasperReport7.html.imageServletUrl</code></td>
+ <td><code class="language-plaintext
highlighter-rouge">/images/</code></td>
+ <td>URL that, when prefixed with the context path, returns report
images</td>
+ </tr>
+ </tbody>
+</table>
+
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><constant</span> <span
class="na">name=</span><span
class="s">"struts.jasperReport7.csv.defaultDelimiter"</span> <span
class="na">value=</span><span class="s">";"</span><span class="nt">/></span>
+<span class="nt"><constant</span> <span class="na">name=</span><span
class="s">"struts.jasperReport7.html.imageServletUrl"</span> <span
class="na">value=</span><span class="s">"/report-images/"</span><span
class="nt">/></span>
+</code></pre></div></div>
+
+<h3 id="installation">Installation</h3>
+
+<p>This plugin can be installed by copying the plugin jar into your
application’s <code class="language-plaintext
highlighter-rouge">/WEB-INF/lib</code> directory. The plugin
+brings the JasperReports 7 core library with it, but the PDF exporter lives in
a separate JasperReports artifact
+which is an optional dependency of the plugin. As <code
class="language-plaintext highlighter-rouge">pdf</code> is the default format,
most applications need to add it:</p>
+
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nt"><dependencies></span>
+ ...
+ <span class="nt"><dependency></span>
+ <span class="nt"><groupId></span>org.apache.struts<span
class="nt"></groupId></span>
+ <span
class="nt"><artifactId></span>struts2-jasperreports7-plugin<span
class="nt"></artifactId></span>
+ <span class="nt"><version></span>STRUTS_VERSION<span
class="nt"></version></span>
+ <span class="nt"></dependency></span>
+ <span class="nt"><dependency></span>
+ <span class="nt"><groupId></span>net.sf.jasperreports<span
class="nt"></groupId></span>
+ <span class="nt"><artifactId></span>jasperreports-pdf<span
class="nt"></artifactId></span>
+ <span class="nt"><version></span>JASPERREPORTS_VERSION<span
class="nt"></version></span>
+ <span class="nt"></dependency></span>
+ ...
+<span class="nt"></dependencies></span>
+</code></pre></div></div>
+
+<p>Use the same <code class="language-plaintext
highlighter-rouge">JASPERREPORTS_VERSION</code> as the <code
class="language-plaintext highlighter-rouge">jasperreports</code> artifact
pulled in by the plugin.</p>
+
+<h2 id="migrating-from-the-jasperreports-plugin">Migrating from the
JasperReports plugin</h2>
+
+<p>The result parameters shared with the <a
href="../jasperreports">JasperReports Plugin</a> behave the same way. What
changed:</p>
+
+<ul>
+ <li>the package is <code class="language-plaintext
highlighter-rouge">jasperreports7-default</code> and the result type is <code
class="language-plaintext highlighter-rouge">jasperReport7</code></li>
+ <li><code class="language-plaintext highlighter-rouge">format</code> values
are lower-case (<code class="language-plaintext highlighter-rouge">pdf</code>
instead of <code class="language-plaintext highlighter-rouge">PDF</code>);
<code class="language-plaintext highlighter-rouge">xls</code> is gone, use
<code class="language-plaintext highlighter-rouge">xlsx</code></li>
+ <li>the <code class="language-plaintext highlighter-rouge">delimiter</code>
and <code class="language-plaintext highlighter-rouge">imageServletUrl</code>
result parameters are gone; use the constants from <a
href="#settings">Settings</a>
+or <code class="language-plaintext
highlighter-rouge">JasperReport7Aware.getCsvDelimiter</code> instead</li>
+ <li>the <code class="language-plaintext
highlighter-rouge">exportParameters</code> result parameter is gone; exporter
configuration is done in code by a
+<a href="#custom-exporters">custom exporter</a></li>
+ <li><code class="language-plaintext
highlighter-rouge">JasperReport7Aware</code> is new; there is no equivalent
hook in the 6.x plugin</li>
+ <li>the PDF exporter is no longer bundled, add <code
class="language-plaintext highlighter-rouge">jasperreports-pdf</code> (see <a
href="#installation">Installation</a>)</li>
+</ul>
+
+ </section>
+</article>
+
+
+<footer class="container">
+ <div class="col-md-12">
+ Copyright © 2000-2025 <a href="https://www.apache.org/">The Apache
Software Foundation</a>.
+ Apache Struts, Struts, Apache, the Apache feather logo, and the Apache
Struts project logos are
+ trademarks of The Apache Software Foundation. All Rights Reserved.
+ </div>
+ <div class="col-md-12">Logo and website design donated by <a
href="https://softwaremill.com/">SoftwareMill</a>.</div>
+</footer>
+
+<a href="https://twitter.com/x?ref_src=twsrc%5Etfw"
class="twitter-follow-button" data-show-count="false">Follow @x</a>
+<script async src="/js/twitter-widgets.js" charset="utf-8"></script>
+
+<div id="fb-root"></div>
+
+<script>(function (d, s, id) {
+ var js, fjs = d.getElementsByTagName(s)[0];
+ if (d.getElementById(id)) return;
+ js = d.createElement(s);
+ js.id = id;
+ js.src = "/js/facebook-all.js";
+ fjs.parentNode.insertBefore(js, fjs);
+}(document, 'script', 'facebook-jssdk'));</script>
+
+
+</body>
+</html>