Galera, alguem sabe como que eu faço para abrir um pop-up do IE com o relatório em pdf??
O pdf já abre, mas abre na mesma janela, eu queria abrir em uma janela diferente!
[]'s
David.
Galera, alguem sabe como que eu faço para abrir um pop-up do IE com o relatório em pdf??
O pdf já abre, mas abre na mesma janela, eu queria abrir em uma janela diferente!
[]'s
David.
Como é chamado esse PDF ou o seu servlet que escreve um PDF? através de um link?
Se for um link isso resolve.
<a href="SEULINK" target="_blank">Link</a>
Se for um javascript isso resolver.
popUp = window.open("SEUSERVLET","popup",'left=60,top=20,width=0,height=0,toolbar=no,status=no,location=no');
Espero ter ajudado.
Eu chamo ele no Action, através do código:
public ActionForward pesquisar(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws WebActionException {
List listBeansRelatorio = new ArrayList();
BusinessDelegate bd = this.getBusinessDelegate();
DynaActionFormBean parcelaForm = (DynaActionFormBean) form;
String data = (String) parcelaForm.get("dtEspecifica");
try {
Collection listParcela = ((RelatorioBusinessDelegate) bd).buscarParcelaByData(DateUtils.convertToDate(data));
Iterator i = listParcela.iterator();
while(i.hasNext()) {
ParcelaVO parcelaVO = (ParcelaVO) i.next();
ProjetoVO projetoVO = new ProjetoVO();
projetoVO.setId(parcelaVO.getProjeto_id());
projetoVO = (ProjetoVO) ((RelatorioBusinessDelegate) bd).findById(projetoVO);
listBeansRelatorio.add(new RelatorioBean(parcelaVO, projetoVO));
}
byte[] bytes = null;
try {
bytes = JasperRunManager.runReportToPdf(request.getSession().getServletContext().getRealPath("relatorio.jasper"), new HashMap(), new JRBeanCollectionDataSource(listBeansRelatorio));
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
response.getOutputStream().write(bytes, 0, bytes.length);
response.getOutputStream().flush();
response.getOutputStream().close();
} catch(Exception e) {
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
e.printStackTrace(printWriter);
response.setContentType("text/plain");
try {
response.getOutputStream().print(stringWriter.toString());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
} catch (brPersistException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
e no .jsp, está assim:
<html:button property="inserir" value=" Gerar Faturamento " styleClass="bto1" onclick="submitTo(window.document.relatorioForm, '/relatorio.do', 'pesquisar', '', 'true');" />
Aquele seus códigos servem?