title: view scoped managed bean is null
body: <p>I'm using glassfish 4 recently. I have a jsf page with  primefaces datatable component. But when I submit the form ,it always shows "target unreachable identifier resolved to null. I changed the scope from request to viewed and then to session scope, but none of them works. I have read similar questions without any progress. 
  here is the jsf page:</p>
  
  <pre><code>&lt;ui:define name="content"&gt;
   &lt;h:form id="orderform"&gt;
     &lt;h:panelGroup id="orderinfor"&gt;
     &lt;p:panelGrid columns="6"&gt;
     &lt;f:facet name="header"&gt;  
        new order  
       &lt;/f:facet&gt; 
      &lt;h:outputLabel for="orderday" value="order day:" /&gt;  
   &lt;p:calendar value="#{orderInfo.orderInfo_Day}"      id="orderday" pattern="yyyy-mm-dd"/&gt;
  &lt;h:outputLabel for="ordername" value="order name *" /&gt; 
  &lt;p:inputText id="ordername" value="# {orderInfo.orderInfo_name}"/&gt;
  &lt;h:outputLabel for="ordernnum" value="order number：" /&gt; 
  &lt;p:inputText id="ordernnum" value="#{orderInfo.orderInfo_workId}"/&gt;    
  
  &lt;h:outputLabel for="ordermemo" value="memo：" /&gt; 
  &lt;p:inputText id="ordermemo" value="#{orderInfo.orderInfo_Memo}"/&gt;            
  
  &lt;/p:panelGrid&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code> &lt;h:panelGroup id="orderpathpanel"&gt;
   &lt;p:dataTable id="multiDepts" var="depwork" value="#{dbOrderManager.workpaths}" paginator="false"   
                                   selection="#{orderInfo.selectedDepartments}" rowKey="#{depwork.manualwork_dept.dept_Id}"&gt;  
  
   &lt;f:facet name="header"&gt;  
   path  
   &lt;/f:facet&gt;  
  
   &lt;p:column selectionMode="multiple" style="width:2%" /&gt;  
  
    &lt;p:column headerText="department name" style="width:10%"&gt;  
                                   #{depwork.manualwork_dept.dept_name}  
  &lt;/p:column&gt;  
  &lt;p:column headerText="order number" style="width:2%"&gt;  
   &lt;p:spinner size="2" min="1" value="#{depwork.manualwork_workOrder}" /&gt;
  &lt;/p:column&gt; 
  
   &lt;p:column headerText="memo" style="width: 100%;"&gt;  
   &lt;p:inputText style="width: 100%;" value="#{depwork.manualwork_Memo}"/&gt; 
   &lt;/p:column&gt; 
   &lt;/p:dataTable&gt;  
  &lt;h:commandButton id="multiViewButton" action="#{dbOrderManager.saveOrder(orderInfo)}" value="add order"&gt;
  
  
         &lt;/h:commandButton&gt;
        &lt;/h:panelGroup&gt;
      &lt;/h:form&gt;
    &lt;/ui:define&gt;
  </code></pre>
  
  <p>And here is the Managed Bean</p>
  
  <pre><code>@Named(value = "orderInfo")
  @ViewScoped
  public class OrderInfo implements Serializable {
  
  private OrderPath[] selectedDepartments;
  private Date orderInfo_Day;
  
  // get and set methods...
  </code></pre>
  
  <p>}</p>
  
  <p>The OrderPath is a plain object class</p>
  
  <pre><code>public class OrderPath  implements Serializable {
  //..
  }
  </code></pre>
  
  <p>And the error message is:</p>
  
  <pre><code>/testorder.xhtml @49,127 selection="#{orderInfo.selectedDepartments}": Target Unreachable, identifier 'orderInfo' resolved to null
  </code></pre>
  
  <p>I tried with p:commandButton and h:commandButton, but got the same error.</p>