首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IceFaces - commandButton不回调理

IceFaces - commandButton不回调理
EN

Stack Overflow用户
提问于 2016-01-12 10:46:43
回答 1查看 77关注 0票数 0

CommandButton不会从操作中返回附件(txt文件)。我没有错误。只是什么都没发生。

Java代码:

代码语言:javascript
复制
 FacesContext facesContext = FacesContext.getCurrentInstance();
 HttpServletResponse response = (HttpServletResponse)facesContext.getExternalContext().getResponse();
 response.setContentType("application/txt");
 response.setHeader("Content-Disposition","attachment;filename=file.txt");
 IOUtils.copy(new StringReader("TEST"), response.getOutputStream());
 facesContext.responseComplete();
 facesContext.renderResponse();

iceFaces - jspx

代码语言:javascript
复制
            <ice:commandButton 
                id="downloadBtn" 
                action="#{contentsBean.downloadAsZip}" 
                value="txt" partialSubmit="true" immediate = "true" >       
            </ice:commandButton>

我尝试使用commandButton,因为我不能使用ice:outputResource。

EN

回答 1

Stack Overflow用户

发布于 2016-08-25 16:52:55

您可以在网站上使用ice:outputResource作为不可见按钮。当用户单击commandButton时,您可以在ice上导出类似于"onClick“的内容:使用javaScript的outputResource。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34741573

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档