Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>package mx.gob.campeche.sit.web.reportes; import java.io.IOException; import java.io.OutputStream; import javax.inject.Inject; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import mx.gob.campeche.sit.doc.recibo_oficial.ReciboOficial; @WebServlet("/reciboOficial") public class ReporteReciboOficialServlet extends HttpServlet { @Inject ReciboOficial reciboOficial; /** * */ private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpServletRequestWrapper srw = new HttpServletRequestWrapper(request); String folio = ""; if (request.getParameterMap().containsKey("folio")) { folio = request.getParameter("folio"); System.out.println("contenido" + folio); }else if (request.getParameterMap().containsKey("numero")) { folio = request.getParameter("numero"); System.out.println("contenido" + folio); }else{ throw new ServletException("No ingreso parametro"); } byte[] pdfData = reciboOficial.crearReciboOFicialCajas(folio, srw.getRealPath("")); response.setContentType("application/pdf"); response.reset(); response.setContentType("application/pdf"); response.setHeader("Content-disposition", "inline; filename=\"" +"samplePDF2.pdf" +"\""); OutputStream output = response.getOutputStream(); output.write(pdfData); output.close(); } this is small example, this help </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload