将请求param添加到PrimeFaces高级FileUpload
我正在尝试将请求参数添加到高级PrimeFaces p:fileupload
。我尝试这样做以在servlet.filter
中检查此参数。使用f:param
带有简单p:fileupload模式=“ simple”
正常工作:
<h:form enctype="multipart/form-data">
<p:fileUpload value="#{myBean.file}" mode="simple" skinSimple="true"/>
<p:commandButton value="Submit" ajax="true" action="#{myBean.upload}">
<f:param name="doStuffInFilter" value="true"/>
</p:commandButton>
</h:form>
但是,我无法使其与p:fileupload模式使用=“高级”
要工作的组件:
<h:form enctype="multipart/form-data">
<p:fileUpload id="fileUploadPrimefaces1" listener="#{myBean.handleFileUpload}"
mode="advanced" dragDropSupport="true" ... />
</h:form>
我尝试过的:
- add
f:param
top:fileupload
- &gt;似乎没有 - 基于 stackoverflow答案的 效果:
<p:fileUpload mode="advanced" ... onstart="this.cfg.ext={params: [name: 'doStuffInFilter', value: 'true']}" />
虽然我可以看到该值是使用浏览器开发工具设置的,但httpservletrequest
不包含服务器上的参数。您知道如何解决这个问题吗?
I am trying to add a request parameter to an advanced primefaces p:fileUpload
. I try to do this in order to check for this parameter in a Servlet.Filter
. Using f:param
with a simple p:fileUpload mode="simple"
works fine:
<h:form enctype="multipart/form-data">
<p:fileUpload value="#{myBean.file}" mode="simple" skinSimple="true"/>
<p:commandButton value="Submit" ajax="true" action="#{myBean.upload}">
<f:param name="doStuffInFilter" value="true"/>
</p:commandButton>
</h:form>
However, i can not get this to work with the p:fileUpload mode="advanced"
Component to work:
<h:form enctype="multipart/form-data">
<p:fileUpload id="fileUploadPrimefaces1" listener="#{myBean.handleFileUpload}"
mode="advanced" dragDropSupport="true" ... />
</h:form>
What i tried:
- Add
f:param
top:fileUpload
-> does not seem to have any effect - Based on this Stackoverflow Answer, I tried to add the param to the request using the Primefaces ClientAPI like this:
<p:fileUpload mode="advanced" ... onstart="this.cfg.ext={params: [name: 'doStuffInFilter', value: 'true']}" />
While I could see that the value was set using the browser dev tools, the HttpServletRequest
did not contain the parameter on serverSide. Do you have any Idea how to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论