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?