Reputation: 831
in a brief word here is the problem when i value change of the menu it execute the post-constructor again in backing bean then execute method fillAreas and i used view scope .
<p:selectOneMenu id="governate" value="#{add.selectedGovern}" style="height:26px; text-align: right; width: 303px;"
valueChangeListener="#{add.fillAreas}" rendered="#{languageBean.isDefaultLanguage==true}" immediate="true" >
<f:selectItem itemLabel="---#{prompts._select} ---" itemValue="0"/>
<f:selectItems value="#{add.governrateList}" var="govern" itemLabel="#{govern.governrateName}" itemValue="#{govern.governrateId}" />
<f:ajax immediate="true"/>
</p:selectOneMenu>
what can i do to prevent calling post-constructor ? and if post-constructor called once why it called every time i select from menu ? Thanks in advance .
Upvotes: 0
Views: 323
Reputation: 1109655
A view scoped bean will be recreated on every single request when a property of it is been bound to an attribute of a taghandler (JSTL <c:forEach>
, Facelets <ui:include>
, JSF <f:validateXXX>
, etc) or to the binding
or id
attribute of a JSF UI component (<h:someComponent>
, etc).
This is related to JSF issue 1492. You could solve it by disabling the partial state saving for the specific view, or by looking for alternate ways to achieve the desired functional requirement.
Upvotes: 1