I have a p:fileUpload component with a listener method defined and I need to pass additional attributes to use during file handling. My idea is to use the f:attribute element inside the p:fileUpload component as follow:
Code: Select all
<p:fileUpload fileUploadListener="#{dataObjectBean.handleFileUpload}" mode="advanced" dragDropSupport="true">
<f:attribute name="simpleAtt" value="mySimpleAtt" />
<f:attribute name="activeFlag" value="#{dataObjectBean.isActive}" />
</p:fileUpload>
Code: Select all
public void handleFileUpload(FileUploadEvent event)
{
Map myAttributes = event.getComponent().getAttributes();
LOG.info(myAttributes.get("simpleAtt")); // displays value
LOG.info(myAttributes.get("activeFlag")); // displays null
}
Code: Select all
<f:attribute name="trueAttr" value="#{true}" />
Please note that this approach should work according to http://stackoverflow.com/questions/1723 ... 2#17236222