在Primefaces 6.0中,我需要在上传文件之前对其进行处理,当我完成按下浏览按钮时,我会尝试调用另一个方法。我尝试使用remoteCommand,但它不起作用。
<p:fileUpload allowTypes="/(\.|\/)(csv|zip)$/"
value="#{geoDataBean.file}" mode="simple" oncomplete="loadCountries();"
update="countriesDropdownPanel">
</p:fileUpload>
<p:remoteCommand name="loadCountries" process="@this"
action="#{geoDataBean.loadCountries()}"/>
<h:panelGroup id="countriesDropdownPanel">
<p:selectCheckboxMenu
widgetVar="countryCode"
id="countryCodeId"
value="#{geoDataBean.selectedCountryCodes}"
label="#{geoDataBean.label}"
multiple="true"
panelStyle="width:198px">
<p:ajax
event="toggleSelect"
update="countryCodeId"
listener="#{geoDataBean.update}" />
<f:selectItems value="#{geoDataBean.countryCodeList}" />
</p:selectCheckboxMenu>
</h:panelGroup>
<h:commandButton value="Import" action="#{geoDataBean.importGeoData}" />我需要在导入之前处理文件,因为我需要查看文件中存在哪些国家/地区来导入它们。
我使用UploadedFile。
https://stackoverflow.com/questions/47450343
复制相似问题