为什么Primefaces Media Dynamic在视图范围内不起作用? [英] Why primefaces media dynamic doesn't work in view scope?

查看:115
本文介绍了为什么Primefaces Media Dynamic在视图范围内不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用media primefaces标签显示pdf,但是如果bean是@ViewScope,则流始终为null,为什么?

解决方案

因为当Web浏览器将要在完全独立的(!!)HTTP请求中下载PDF时,所需的JSF视图状态不可用.本质上,与PrimeFaces <p:graphicImage>完全相同,是在以下问题中回答的问题:

基本上,您需要将所需媒体文件的标识符作为<f:param>传递,然后创建一个完全无状态的受管bean,该bean根据当前请求阶段ID和所提供的请求参数来流传输所需的DefaultStreamedContent.

I use the media primefaces tag to present pdf's but if the bean is @ViewScope the stream is always null, why?

解决方案

Because the desired JSF view state isn't available when the webbrowser is about to download the PDF in an entirely separate(!!) HTTP request. This is essentially exactly the same problem as with PrimeFaces <p:graphicImage> as answered in the following questions:

Basically, you need to pass an identifier of the desired media file as <f:param> and then create an entirely stateless managed bean which streams the desired DefaultStreamedContent depending on the current request phase ID and the supplied request parameter.

这篇关于为什么Primefaces Media Dynamic在视图范围内不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆