【发布时间】:2018-11-03 09:13:24
【问题描述】:
我要求我必须将 inputText 的值传递给包含文件版本以及文件上传的支持 bean。 我一直在尝试使用远程命令来实现它,但没有工作。
下面是我的代码:
<h:form enctype="multipart/form-data" id="uploadForm">
<p:growl id="messages" showDetail="true" />
<p:outputLabel for="vers" value="File Version:" />
<p:inputText id="vers" name="vers"
value="#{remoteDeployment.uploadedVersion}" placeholder="1.x.x.x"
maxlength="17" required="true"
requiredMessage="Version is required." />
<p:separator />
<p:fileUpload onstart="submitVersion()"
fileUploadListener="#{remoteDeployment.upload}" update="messages" >
<f:attribute name="terminalSettings" value="#{as}" />
</p:fileUpload>
<p:remoteCommand name="submitVersion" process="@this vers" />
</h:form>
用于输入文本的支持 bean 中的字符串:
@ViewScoped
private String uploadedVersion;
public String getUploadedVersion() {
return uploadedVersion;
}
public void setUploadedVersion(String uploadedVersion) {
this.uploade
请帮忙,如果有其他方法,请告诉我。
谢谢
【问题讨论】:
-
用 onclick 改变 onstart 并告诉我是否有任何不同
-
@YagamiLight 不起作用。
-
你尝试过 primefaces 网站上的经典文件上传方法吗?!?
-
@YagamiLight 是的,来自网站。
-
我会发布对我有用的文件上传并告诉我是否有区别好吗?!?
标签: jsf input file-upload primefaces jsf-2