You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Tom Schneider (JIRA)" <ji...@apache.org> on 2007/10/30 04:54:41 UTC

[jira] Commented: (WW-1946) JasperReports-Plugin custom parameteres

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

Tom Schneider commented on WW-1946:
-----------------------------------

I recommend that we not make this change.  In the JasperReportsResult, we initially create the parameters map by wrapping the value stack in a ValueStackShadowMap.  This means that any properties on your webwork action should be exposed to webwork via the parameters map.

So in the example above, if you had a titulo02 and titulo03 property on your action set to the appropriate values, then the existing webwork action should expose those to jasper.

I would recommend that we update the documentation with an example of how this would work before we close this issue.  I think that this behavior isn't obvious and we should make sure we have enough information available so one wouldn't need to look in the code to figure out what's going on.

> 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.1
>
>
> 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.