js代码:
xtype:'button',
text : "下载",
height:25,
cls :'search_btn',
iconCls : "client_searchIcon",
listeners:{
"click":function(){
window.location.href = "orgIncome_getPdf.action?fileName=first.pdf";
}
}
后台代码:
public InputStream getPdf() {
System.out.println(ServletActionContext.getServletContext().getRealPath("/")+fileName);
return ServletActionContext.getServletContext().getResourceAsStream(
ServletActionContext.getServletContext().getRealPath("/")
+ fileName);
}配置文件:
<action name="orgIncome_*" method="{1}" class="OrgIncomeAction">
<interceptor-ref name="watertekinterceptor" />
<interceptor-ref name="defaultStack" />
<result name="goOrgIncome">/jsp/statistics/orgIncome.jsp</result>
<result name="goOrgType">/jsp/statistics/orgType.jsp</result>
<result name="goOrgIncomeAndType">/jsp/statistics/orgIncomeAndType.jsp</result>
</action>
xtype:'button',
text : "下载",
height:25,
cls :'search_btn',
iconCls : "client_searchIcon",
listeners:{
"click":function(){
window.location.href = "orgIncome_getPdf.action?fileName=first.pdf";
}
}
后台代码:
public InputStream getPdf() {
System.out.println(ServletActionContext.getServletContext().getRealPath("/")+fileName);
return ServletActionContext.getServletContext().getResourceAsStream(
ServletActionContext.getServletContext().getRealPath("/")
+ fileName);
}配置文件:
<action name="orgIncome_*" method="{1}" class="OrgIncomeAction">
<interceptor-ref name="watertekinterceptor" />
<interceptor-ref name="defaultStack" />
<result name="goOrgIncome">/jsp/statistics/orgIncome.jsp</result>
<result name="goOrgType">/jsp/statistics/orgType.jsp</result>
<result name="goOrgIncomeAndType">/jsp/statistics/orgIncomeAndType.jsp</result>
</action>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货