【问题标题】:Jsp page need not to be DisplayedJsp页面不需要显示
【发布时间】:2013-02-15 10:27:28
【问题描述】:

我有一个 jsp 页面,我从中调用一个 Java 类。该类包含生成 pdf 的代码。

现在,当我单击按钮时,还会显示一个空的 jsp 以及 pdf。我希望当我单击按钮时该 jsp 页面不会打开。应该只显示那个 pdf。

这是我的 jsp 页面。我正在调用使用 Windchill API 的类

<%@page import="wt.part.WTPart"%>
<%@page import="wt.fc.WTObject"%>
<%@page import="ext.gt.checkOut.New"%>
<%
    String part2="GT024";
    ext.gt.checkOut.New.pdf1(part2);
%>

【问题讨论】:

  • 看jsp代码可能会更好。
  • @Alexey:我已经添加了代码

标签: java jsp ptc-windchill


【解决方案1】:

尝试添加
&lt;%
response.setContentType("application/pdf");
response.setHeader("Content-disposition", "attachment; filename=yourfilename.pdf");
%&gt;

【讨论】:

    【解决方案2】:

    取自 Windchill 问答网站 http://ezcollab.com/questions/93/how-to-stream-file-in-jsp

    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition","attachment;filename=\"" + fileName + "\"");       
    BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(response.getOutputStream());     
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-10
      • 2013-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-26
      相关资源
      最近更新 更多