jsf 2.2 - Primefaces datatable and ViewScoped -


i'm using primefaces 5.0 on wildfly 8.2.0 (mojarra 2.2.8).

i tried use simple primefaces datatable expansion each time expand row, backed bean @postconstruct triggered (which reloads data nullifies use of @viewscoped in first place).

i've seen other questions on stackoverflow problem no solution worked me:

  • i'm using jsf 2.2+
  • i'm not using jstl tags
  • i disabled partial state saving in web.xml
  • i tried using different @viewscoped (bean, view , omnifaces'one)

my bean:

@named @javax.faces.view.viewscoped @suppresswarnings("serial") public class testbean implements serializable {      private list<string> things;      @postconstruct     public void initialize() {         system.out.println("initializing...");         this.things = arrays.aslist("michael", "david", "paul");     }      public list<string> getthings() {         return this.things;     } } 

my template:

<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"       xmlns:h="http://xmlns.jcp.org/jsf/html"       xmlns:f="http://xmlns.jcp.org/jsf/core"       xmlns:p="http://primefaces.org/ui">     <h:head>         <title>test</title>     </h:head>     <h:body>         <p:datatable value="#{testbean.things}" var="thing">             <p:column>                 <p:rowtoggler />             </p:column>             <p:column>                 <h:outputtext value="#{thing}" />             </p:column>             <p:rowexpansion>                 <h:outputtext value="#{thing}" />             </p:rowexpansion>         </p:datatable>     </h:body> </html> 

to work, <p:datatable> has inside <h:form>.


Comments