Pass the value of another input component when downloading a file via p: fileUpload mode = advanced

I have add a mainface file.

<h:form id="form" enctype="multipart/form-data">    
<h:selectOneMenu id="Collection" value="#{imputData.collList.currentColl}">
<f:selectItems value="#{imputData.collList.collList}" />
</h:selectOneMenu>      
<p:fileUpload id="fileUpload" label="Durchsuchen" uploadLabel="Upload" cancelLabel="zurück" fileUploadListener="#{imputData.handleFileUpload}" mode="advanced" dragDropSupport="true" update="Collection,messages" sizeLimit="100000" allowTypes="/(\.|\/)(txt|cvs)$/" />  

 <p:growl id="messages" showDetail="true"/>             
<h:commandButton id="read" action="#{imputData.imput}" value="#{msgs.read}"/>

</h:form>

Looks like this date Improt Primefaces

I have two questions. How can I make fileupload smaller. The average is not too large on the hole page?

To get the name from selectOneMenu, I have to click on the reader button (Lesen). If I click and upload button, I do not receive any information from SelectOneMenu (null). Do I have to write ajax = "true" in <p:fileUpload..or something to get information from selectOneMenu in the upload button?

I am writing Id from the collection in the fileUpload update update="Collection,messages", but this does not indicate my problem.

+4
1

onstart , remoteCommand selectOneMenu bean, .

<p:fileUpload id="fileUpload" mode="advanced" onstart="submitCollection()" />

<p:remoteCommand name="submitCollection" process="@this Collection" />

, css:

.ui-fileupload {
   width: 400px;//change the px into what fits you
}

, .

+5

Source: https://habr.com/ru/post/1535980/


All Articles