The value to which input component in "ui:repeat" is displayed
is different according to "done/not done" and "SEVERITY" of "FacesContext.addMessage".
a) When "addMessage()" is not done, it is a value of BackingBean.
b) When "addMessage()" is done, and SEVERITY is FATAL, it is a value of BackingBean.
c) When "addMessage()" is done, and SEVERITY is not FATAL, it is a value input on the screen.
Moreover, it is always a value of BackingBean when input compoment is included in h:dataTable or it is not included anywhere.
Moreover, it is always a value of BackingBean when compoment is not input.(example. <h:outputText>)
Is this behavior a specification or bug?
How should I correspond to this behavior?
Please advise.
----------------------------------
(XHTML)
<h:commandButton id="change" value="change" action="#{NewBean.change}"/> <!-- not immediate -->
<ui:repeat id="list" value="#{NewBean.masterList}" var="row">
<h:inputText id="code" value="#{row.code}" required="true"/>
<h:outputText value="#{row.name}"/>
</ui:repeat>
----------------------------------
(Bean)
@ManagedBean(name = "NewBean")
@ViewScoped
public class NewBean implements Serializable {
// List for ui:repeat
private List<Master> masterList;
public NewBean() {
// create List and set inicial value
this.masterList = new ArrayList<Master>();
this.masterList.add(new Master("Code_0", "Name_0"));
this.masterList.add(new Master("Code_1", "Name_1"));
}
public String change() {
// change value in List
for (int i = 0; i < this.masterList.size(); i++) {
this.masterList.get(i).setCode("Code_changed_" + i);
this.masterList.get(i).setName("Name_changed_" + i);
}
// add message
FacesMessage.Severity severity = FacesMessage.SEVERITY_INFO;
FacesContext.getCurrentInstance()
.addMessage(null, new FacesMessage(severity, "Change Success", "Change Success"));
}
}
----------------------------------
[Message sent by forum member 'jandoe3527']
http://forums.java.net/jive/thread.jspa?messageID=472372