1
這是我的Sample支持bean。PrimeFaces命令按鈕不會在提交時更新表格
@ManagedBean
@SessionScoped
public class Sample {
private String dateText;
public Sample(){
dateText = (new Date()).toString();
}
public String updateDate(){
setDateText((new Date()).toString());
return null;
}
public String getDateText() {
return dateText;
}
public void setDateText(String dateText) {
this.dateText = dateText;
}
}
方案01
<h:head></h:head>
<h:body>
<h:form>
<h:inputText id="txtFirst" value="#{sample.dateText}"/>
<h:inputText id="txtSecond" value="#{sample.dateText}"/>
<h:commandButton action="#{sample.updateDate}"/>
</h:form>
</h:body>
方案02
<h:head></h:head>
<h:body>
<h:form>
<h:inputText id="txtFirst" value="#{sample.dateText}"/>
<p:inputText id="txtSecond" value="#{sample.dateText}"/>
<h:commandButton action="#{sample.updateDate}"/>
</h:form>
</h:body>
方案03
<h:head></h:head>
<h:body>
<h:form>
<h:inputText id="txtFirst" value="#{sample.dateText}"/>
<p:inputText id="txtSecond" value="#{sample.dateText}"/>
<p:commandButton action="#{sample.updateDate}"/>
</h:form>
</h:body>
方案04
<h:head></h:head>
<h:body>
<h:form>
<h:inputText id="txtFirst" value="#{sample.dateText}"/>
<p:inputText id="txtSecond" value="#{sample.dateText}"/>
<p:commandButton action="#{sample.updateDate}" update="@form"/>
</h:form>
</h:body>
當我點擊commandButton
,
方案01:正常工作。我可以在兩個inputText
字段中看到新的日期值,而無需手動刷新頁面。
情景02:刷新頁面。看不到任何ajax行爲。新的價值在那裏。
情景03:沒有任何反應。沒有刷新。沒有價值變化。要查看我必須手動刷新頁面的值。
方案04:工程就像方案01
請別人給我什麼發生在這裏與這些組件一點解釋。 我已經使用ICEfaces
,但我沒有看到任何這樣的事情。
謝謝!
所以你說'' 成分不爲' '或'' 默認工作? –
sura2k
不,他在說ICEfaces正在改變默認的JSF行爲。它加載了一個額外的JS文件,它默默地將每個標準的JSF命令組件轉換爲啓用ajax的組件,並默認爲'render =「@form」'。 PrimeFaces不會觸及標準的JSF命令組件。另見http://www.icesoft.org/wiki/display/ICE/Disabling+Ajax – BalusC
你被告知,之前,順便說一句:http://stackoverflow.com/questions/15131582/jsf-file-download -doesnt-work – BalusC