jsf - View scoped bean is instantiated twice on one page, if there is no redirect when going to page -


i have page use @viewscoped bean. on page data bean, , call action on it. this:

<h:form>   <h:datatable value="#{partybean.foundorganisations}" var="party">     <h:column headerclass="header">       <f:facet name="header">         #{msgs['company.registration.number']}       </f:facet>       <h:commandlink value="#{party.registrationnumber}" action="#{partybean.select}">         <f:setpropertyactionlistener value="#{party}" target="#{partybean.selectedparty}" />       </h:commandlink>     </h:column>   </h:datatable> </h:form> 

partybean @viewscoped. when page navigation rule <redirect />, works fine, when there no <redirect />, foundorganisations taken 1 instance of bean, setselectedparty called on instance of bean when link clicked. checked debug.

why that? can make work without <redirect />?

i think normal. partybean renew new view. submit same page can change commandlink command button , return null in action method. in way jsf acts same view.

or can try keep selectedparty value in hiddenfield (not tested in jsf 2.0)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -