我有一個頁面,使用rich:fileUpload
和a4j:commandButton
我想實現的是,第一次加載頁面fileUpload出現(被呈現,我的backingBean默認爲真,所以它呈現正確),當用戶點擊命令按鈕我很想隱藏文件上傳和顯示的outputText
(這是不會發生,沒有錯誤可言)Richfaces渲染與a4j:ajax
我怎樣才能解決這個問題,我pagelooks像
<div id="content">
<a4j:outputPanel id="contentForm">
<h:form enctype="multipart/form-data"
rendered="#{uploadBean.formRendered}">
<br/><br/>
<h:selectOneRadio value="#{uploadBean.selectedOption}">
<f:selectItems value="#{uploadBean.loadOptions}"/>
</h:selectOneRadio>
<br/>
<rich:fileUpload addLabel="Agregar" clearAllLabel="Quitar todos"
clearLabel="Quitar" deleteLabel="Quitar"
doneLabel="Completado" uploadLabel="Subir archivos"
fileUploadListener="#{uploadBean.doUpload}"
acceptedTypes="txt, csv"
noDuplicate="true"/>
<a4j:commandButton value="Iniciar validación"
action="#{uploadBean.doLaunchProcess}"
render="processLabel"
execute="@form"
/>
</h:form>
</a4j:outputPanel>
<a4j:outputPanel id="processLabel">
<h:outputText
value="#{uploadBean.processStarted}"
rendered="#{not uploadBean.formRendered}"/>
</a4j:outputPanel>
</div>
和commandButton的動作代碼是:
public String doLaunchProcess() {
formRendered = false;
InfoValidator iv = new InfoValidator(loadOptions,
selectedOption, userBean.getDependencia(),
userBean.getTipoDependencia(), userBean.getUsuario(),
userBean.getIdUsuario(), userBean.getEmail());
iv.start();
return "carga-archivos";
}
是似乎formRendered
總是被判斷爲真時,我想一旦用戶點擊該按鈕等等的FileUpload隱藏它是假的,並顯示的outputText。
UPDATE 基本上我想要的是上傳文件的用戶的當在用戶點擊按鈕的FileUpload組件自敗和的outputText出現,說什麼「謝謝上傳」
也許我的方法是錯誤的,只是把我放在正確的方向,我有點混淆與Ajax的東西。
乾杯,
如果嘗試rerender =「processLabel」而不是render =「processLabel」 – HRgiger 2012-02-02 23:05:39
a4j:commandButton沒有任何'reRender'屬性。我與richfaces 4.1和Mojarra 2.1.6和Tomcat – BRabbit27 2012-02-02 23:07:44
我認爲它支持我使用的cas。請檢查http://stackoverflow.com/a/2243473/706695或http://docs.jboss.org/ richfaces/latest_3_3_X/en/devguide/html/a4j_commandButton.html#6.1.6.2。%20Details%20of%20Usage – HRgiger 2012-02-02 23:19:20