title: How to pass 2 or more parameters from jsp page to jasper report
body: <p><a href="https://i.stack.imgur.com/wVoyP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wVoyP.png" alt="enter image description here"></a></p>
  
  <p>I have a search criteria as shown above and also a text field. Here i am using jasper reports. So i have created the parameters in ireport-5.6.0, its working fine in internal preview of ireport-5.6.0, but when i want to send the values that is selected from a jsp page to ireport and print the data in PDF. Its not working. Only for one parameter its working and it is not taking the other two values that are selected.Here are my jsp pages.</p>
  
  <p>Purchase.jsp</p>
  
  <pre><code>&lt;form action="view.jsp" method="post"&gt;
  &lt;select name="complan"&gt;
  &lt;option value=""&gt;Make a selection&lt;/option&gt;
  &lt;option value="Company Name"&gt;Company Name&lt;/option&gt;
  &lt;option value="Contact Person"&gt;Contact Person&lt;/option&gt;
  &lt;option value="Phone Number"&gt;Phone Number&lt;/option&gt;
  &lt;/select&gt;
  &lt;select name="category"&gt;
  &lt;option value=""&gt; Make a selection &lt;/option&gt;
  &lt;option value="company"&gt;company&lt;/option&gt;
  &lt;option value="institution"&gt;institution&lt;/option&gt;
  &lt;option value="hospital"&gt;hospital&lt;/option&gt;
  &lt;option value="Others"&gt;Others&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="text" name="search"/&gt;
  &lt;input type="submit" value="Submit"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>view.jsp</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  
          function setAction(nPage){
  
              document.forms[0].action = nPage;
          }
      &lt;/script&gt;
  &lt;form&gt;
  &lt;% 
  String search=request.getParameter("search");
  session.setAttribute("sea",search);
  String category=request.getParameter("category");
  session.setAttribute("cat",category);
  String complan = request.getParameter("complan");
  session.setAttribute("com",complan);
  %&gt;
  &lt;select onchange="setAction(this.value)"&gt;
  &lt;option value=''&gt; Make a selection &lt;/option&gt;
  &lt;option value='PDF_LEAD.jsp'&gt; PDF&lt;/option&gt;
  &lt;option value='XLS_LEAD.jsp'&gt; XLS &lt;/option&gt;
  &lt;option value='DOC_LEAD.jsp'&gt; DOC &lt;/option&gt;
  &lt;option value='XLSX_LEAD.jsp'&gt; XLSX &lt;/option&gt;
  &lt;/select&gt;
  &lt;br/&gt;
  
  &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PDF_LEAD.jsp</p>
  
  <pre><code>&lt;body&gt;
  &lt;% 
  Connection conn = null;
  String sear=(String)session.getAttribute("sea");
  String cate=(String)session.getAttribute("cat");
  String comp=(String)session.getAttribute("com");
  try 
  { 
      Class.forName("com.mysql.jdbc.Driver");
      conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/marketing_database","root","root");
      String jrxmlFile ="D:/dev/tools/jasper files/report10.jrxml";
      InputStream input = new FileInputStream(new File(jrxmlFile));
      JasperDesign jasperDesign = JRXmlLoader.load(input);
  
      System.out.println("Compiling Report Designs");
      JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
  
      System.out.println("Creating JasperPrint Object");
      Map parameters = new HashMap();
      parameters.put("complan",comp);
      parameters.put("search",sear);
      parameters.put("category",cate);
      JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,parameters,conn);
      byte bytes[] = new byte[10000]; 
      JRPdfExporter exporter = new JRPdfExporter();
      ByteArrayOutputStream PDFStream = new ByteArrayOutputStream(); 
      exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); 
      exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, PDFStream); 
      exporter.exportReport(); 
      System.out.println("Size of byte array:"+PDFStream.size()); 
      bytes = PDFStream.toByteArray(); 
      response.setContentType("application/pdf"); 
      System.out.println("After JasperPrint = 1"); 
      response.setContentLength(bytes.length); 
      System.out.println("After JasperPrint = 2"); 
      PDFStream.close(); 
      System.out.println("After JasperPrint = 3"); 
  
      OutputStream outputStream = response.getOutputStream(); 
      System.out.println("After JasperPrint = 4"); 
      outputStream.write(bytes, 0, bytes.length); 
      outputStream.flush(); 
      outputStream.close(); 
  
  }
  catch(Exception e) 
  {e.printStackTrace();} 
  
  %&gt;
  &lt;/body&gt;
  </code></pre>