我正在使用带有 JSF1.1 的 Tomahawk 库的
控件。
我的扩展过滤器和表单已相应设置,以允许上传最大大小为 3 MB 的文件。但问题是,如果文件超过 3 MB,则表单不会提交,但会再次显示,并且我无法为其设置任何
。
那么我如何告诉用户文件上传失败。
我尝试保留 但没有显示任何内容。
我已按照 BalusC 博客文章设置我的上传。
I am using <t:inputFileUpload />
control of the Tomahawk library with JSF1.1.
My Extension Filters and form are set accordingly to allow a file of max-size 3 MB to be uploaded. But the problem is if a File is more than 3 MB the form doesnt get submitted but is shown again , and i cant set any <h:message>
for it .
So how do i tell the User the file upload has failed.
I have tried keeping <h:messages globalOnly="true"
but nothing gets shown.
I have followed BalusC blog post for setting up my uploads.
发布评论
评论(1)
异常详细信息可在 EL 中找到
,因此,将以下组件添加到页面应该可以完成。
您最终可以创建一个
PhaseListener
,将其转换为FacesMessage
。在PhaseId.RENDER_RESPONSE
的beforePhase()
中执行以下操作The exception detail is available in EL by
So, adding the following component to the page should do it
You could eventually create a
PhaseListener
which turns it into aFacesMessage
. Do the following inbeforePhase()
ofPhaseId.RENDER_RESPONSE