[ 
https://issues.apache.org/struts/browse/WW-1946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Holmes reassigned WW-1946:
--------------------------------

    Assignee: James Holmes  (was: Rainer Hermanns)

> JasperReports-Plugin custom parameteres
> ---------------------------------------
>
>                 Key: WW-1946
>                 URL: https://issues.apache.org/struts/browse/WW-1946
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugins
>    Affects Versions: 2.0.6
>            Reporter: Carlos Cristales
>            Assignee: James Holmes
>             Fix For: 2.1.0
>
>
> I need to pass custom params to the JasperReport-Plugin, to customize the 
> title report by example,
> and I solve my need by this way
> * add a property customParameters to JasperReportsResult with the respective 
> seter:
>     public void setCustomParameters(String customParameters) {
>         this.customParameters = customParameters;
>     }
> * load the customParameters before to generate the report, just after to 
> initialize the
>    parameters property by the plugin:
>                 //getting the map of parameters
>                 Map mapParameters = (Map) stack.findValue(customParameters);
>                 if (mapParameters != null) {
>                         parameters.putAll(mapParameters);
>                 }
> * in the struts2 action, I add a Map property and setting values to customize 
> the report title
>     jasperParams = new HashMap();
>     jasperParams.put("titulo02", "Listado General de Usuarios");
>     jasperParams.put("titulo03", "Filtrados por Departamento y Role");
> * mapping the action in the struts.xml
>                 <action name="usuariosJasper" class="usuarioAction" 
> method="print">
>                         <result name="success" type="jasper">
>                                 <param 
> name="location">/reportes/usuarios.jasper</param>
>                                 <param name="dataSource">usuarios</param>
>                                 <param 
> name="customParameters">jasperParams</param>
>                                 <param name="format">PDF</param>
>                         </result>
>                 </action> 
> P.D
> I'am very newbie in this, and I'am not sure if this the correct way to report 
> this,
> in adition my englhis is very bad, bot I hope this post may to help to 
> someone.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to