我有一個問題,當我使用ap:tabView with dynamic =「true」時,有一個ah:selectOneMenu在一個選項卡上,另一個是commandLink,它是ajax = 「假」。點擊兩次commandLink後,selectOneMenu的值將丟失。Primefaces p:tabView:selectOneMenu的值丟失
當tabView爲動態=「false」時,不會發生此問題。
的H值:inputText的不會丟失,但我看到在日誌文件中以下警告:
org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils decodeUIInput WARNING: There should always be a submitted value for an input if it is rendered, its form issubmitted, and it was not originally rendered disabled or read-only. You cannot submit a form after disabling an input element via javascript. Consider setting read-only to true instead or resetting the disabled value back to false prior to form submission. Component : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /form/regional/region.xhtml][Class: javax.faces.component.html.HtmlBody,Id: j_id_5][Class: javax.faces.component.html.HtmlForm,Id: TestForm][Class: org.primefaces.component.tabview.TabView,Id: tabviewTest][Class: org.primefaces.component.tabview.Tab,Id: j_id_8][Class: javax.faces.component.html.HtmlInputText,Id: j_id_f]}
下面的形式:
<p:tabView dynamic="true" cache="true" id="tabviewTest">
<p:tab title="Tab 1">
<h:selectOneMenu value="#{Region.dropDownValue}" id="dropDown">
<f:selectItem itemLabel="" itemValue=""/>
<f:selectItem itemLabel="1" itemValue="1"/>
<f:selectItem itemLabel="2" itemValue="2"/>
<f:selectItem itemLabel="3" itemValue="3"/>
<f:selectItem itemLabel="4" itemValue="4"/>
</h:selectOneMenu>
<h:inputText value="#{Region.inputValue}" />
</p:tab>
<p:tab title="Tab 2">
<p:commandLink ajax="false"
id="link"
value="Test"
actionListener="#{Region.someActionMethod}" />
</p:tab>
</p:tabView>
而且這裏的豆:
public class Region {
private Integer dropDownValue = 3;
private String inputValue = "Test";
public void someActionMethod(ActionEvent ev) {
System.out.println("someActionMethod called");
}
public Integer getDropDownValue() {
return dropDownValue;
}
public void setDropDownValue(Integer dropDownValue) {
this.dropDownValue = dropDownValue;
}
public String getInputValue() {
return inputValue;
}
public void setInputValue(String inputValue) {
this.inputValue = inputValue;
}
}
我的環境:Primefaces 5.0/5.1.RC1,MyFaces的2.1/2.2,Tomact 7
任何想法可能是錯誤的?
你說的平均「值丟失」?你的意思是價值重置爲默認值?或者它是空白的? – kolossus 2014-10-02 18:14:59
它是空白的.... – 2014-10-03 05:13:36
看到'cache =「true」'和'dynamic =「true」'是有些矛盾的國際海事組織。設置'cache =「true」'並再試一次 – kolossus 2014-10-03 05:14:54