migrating weblogic 10.3.0 server (used java 6 ,jsf framework (Mojarra-2.1.7) and (maven-based) worked totally fine) to weblogic 12c server and also java 6 to java 8 since then having issues of duplicate id in whichever views are using component binding attribute.All managed beans are session scoped and some beans are shared by different views while navigation from one to other.
I have tried replacing the already used jsf jars(Mojarra-2.1.7) to (Mojarra-2.2.2) and javax.faces/javax.faces.api.jar(Mojarra-2.3).Removing binding from jsf components in xhtml and session scopes from the beans doesn't throw duplicate id error but i cannot do that (for a reason). i have read almost every post about id duplication error and this JSF spec- JSF 2.0 spec section 3.1.5 "... It is strongly recommend that application developers place managed beans that are pointed at by component binding expressions in “request” scope, and not any other scope. This is because placing it in session or application scope would require threadsafety, since UIComponent instances depends on running inside of a single thread. There are also potentially negative impacts on memory management when placing a component binding in “session” or “view” scopes.
Just wondering if it had been about bean's scope then this error should have happened with previous weblogic 10.3 and jsf 2.1.7 version as well but it never did.Could it be becoz of the weblogic 12c or java8 or jsf version ??
Component tree :
+id: checkDt
type: org.primefaces.component.datatable.DataTable@6f454948
+id: ColHeader1 <===============
type: org.primefaces.component.column.Column@2efbb3b1
+id: j_idt98
type: javax.faces.component.html.HtmlOutputText@14cbcb4
+id: j_idt99
type: org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox@1025f970
+id: Col2
type: org.primefaces.component.column.Column@556fed35
+id: Name
type: javax.faces.component.html.HtmlOutputLabel@267aaa12
+id: j_idt100
type: org.primefaces.component.tooltip.Tooltip@42370b75
+id: Col3
type: org.primefaces.component.column.Column@7d66943a
+id: reasonText
type: org.primefaces.component.inputtext.InputText@57cac8e6
+id: ColHeader1 <===============
type: org.primefaces.component.column.Column@2493d237
+id: j_idt98
type: javax.faces.component.html.HtmlOutputText@5e051973
+id: j_idt99
type: org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox@170b81cd
+id: Col2
type: org.primefaces.component.column.Column@1687f632
+id: Name
type: javax.faces.component.html.HtmlOutputLabel@2c3f9cbf
+id: j_idt100
type: org.primefaces.component.tooltip.Tooltip@5a07c6ca
+id: Col3
type: org.primefaces.component.column.Column@114921ae
+id: reasonText
type: org.primefaces.component.inputtext.InputText@385673d3
+id: j_idt101
type:
.xhtml file :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:body>
<h:form id="New">
<p:dataTable id="checkDt" var="check" rowIndexVar="rowIndex"
value="#{requestBean.requestVOList}"
binding="#{requestBean.ListDT}" <!-binding is used in parent comp -datatable so all the child component ids are repeated in tree-!>
style="width:90%">
<p:column id="ColHeader1" styleClass="TEXT-ALIGN-CENTER"
style="white-space:normal;text-align:center;width:130px;">
<f:facet name="header">
<h:outputText
value="header 1"></h:outputText>
</f:facet>
<p:selectBooleanCheckbox value="#{check.selectedCheckBox}"
disabled="true">
</p:selectBooleanCheckbox>
</p:column>
<p:column id="Col2"
headerText="header 2">
<h:outputLabel id="Name" value="#{check.nameShort}">
<p:tooltip for="Name" value="#{check.nameShort}"></p:tooltip>
</h:outputLabel>
</p:column>
<p:column id="Col3"
headerText="header 3">
<p:inputText id="reasonText" value="#{check.reason}"
autocomplete="off" disabled="true"></p:inputText>
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
bean :
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIData;
@ManagedBean
@SessionScoped
public class RequestBean {
private RequestVO requestVO = null; // a seperate class (or model) having its property variables and getter setters like selectedCheckBox(boolean),nameShort, reason (Strings)
private List<RequestVO > requestVOList;
private UIData listDT = null;
public List<RequestVO> getRequestVOList() {
return requestVOList;
}
public void setRequestVOList(List<RequestVO > list) {
this.requestVOList= list;
}
public UIData getListDT() {
return listDT;
}
public void setListDT(UIData listDT) {
this.listDT = listDT;
}
}
RequestVO.java :
public class RequestVO{
private boolean selectedCheckBox = false;
private String nameShort=null;
private String reason=null;
public boolean isSelectedCheckBox() {
return selectedCheckBox;
}
public void setSelectedCheckBox(boolean selectedCheckBox) {
this.selectedCheckBox = selectedCheckBox;
}
public String getNameShort() {
return nameShort;
}
public void setNameShort(String nameShort) {
this.nameShort = nameShort;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}
POM:
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>