Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-1946

JasperReports-Plugin custom parameteres

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.0.6
    • 2.1.1
    • Plugin - JasperReports
    • None
    • Patch

    Description

      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.

      Attachments

        Activity

          People

            tschneider Thomas Schneider
            cristales Carlos Cristales
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: