有 2 个表单,只需要 1 个提交按钮:
<h:form>
<h:panelGrid columns="2">
<h:outputText value="#{msgs.shortDescription}"/>
<p:inputText value="#{fileBean.shortDescription}" required="true"/>
<h:outputText value="#{msgs.longDescription}"/>
<p:inputTextarea value="#{fileBean.longDescription}" required="true"/>
<h:selectOneMenu value="#{enumRegistration.selectedRegion}">
<f:selectItems value="#{enumRegistration.regionList}"/>
<f:ajax listener="#{enumRegistration.selectCity}" render="citiesmenu"/>
</h:selectOneMenu>
<h:commandButton value="Submit" action="#{fileBean.updateAd}"/>
</h:panelGrid>
</h:form>
<h:form enctype="multipart/form-data">
<p:fileUpload value="#{fileBean.file}" mode="advanced"
fileUploadListener="#{fileBean.handleFileUpload}"
required="true" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
requiredMessage="You must upload a file"/>
<p:commandButton value="Submit" ajax="false"/>
</h:form>
如何只有 1 个提交按钮?
一种选择是将两者都包含在一个表单中......在常规表单上也有multipart/form-data真的是最好的选择吗?