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:
<ui:define name="content">
<h:form id="orderform">
<h:panelGroup id="orderinfor">
<p:panelGrid columns="6">
<f:facet name="header">
new order
</f:facet>
<h:outputLabel for="orderday" value="order day:" />
<p:calendar value="#{orderInfo.orderInfo_Day}" id="orderday" pattern="yyyy-mm-dd"/>
<h:outputLabel for="ordername" value="order name *" />
<p:inputText id="ordername" value="# {orderInfo.orderInfo_name}"/>
<h:outputLabel for="ordernnum" value="order number:" />
<p:inputText id="ordernnum" value="#{orderInfo.orderInfo_workId}"/>
<h:outputLabel for="ordermemo" value="memo:" />
<p:inputText id="ordermemo" value="#{orderInfo.orderInfo_Memo}"/>
</p:panelGrid>
<h:panelGroup id="orderpathpanel">
<p:dataTable id="multiDepts" var="depwork" value="#{dbOrderManager.workpaths}" paginator="false"
selection="#{orderInfo.selectedDepartments}" rowKey="#{depwork.manualwork_dept.dept_Id}">
<f:facet name="header">
path
</f:facet>
<p:column selectionMode="multiple" style="width:2%" />
<p:column headerText="department name" style="width:10%">
#{depwork.manualwork_dept.dept_name}
</p:column>
<p:column headerText="order number" style="width:2%">
<p:spinner size="2" min="1" value="#{depwork.manualwork_workOrder}" />
</p:column>
<p:column headerText="memo" style="width: 100%;">
<p:inputText style="width: 100%;" value="#{depwork.manualwork_Memo}"/>
</p:column>
</p:dataTable>
<h:commandButton id="multiViewButton" action="#{dbOrderManager.saveOrder(orderInfo)}" value="add order">
</h:commandButton>
</h:panelGroup>
</h:form>
</ui:define>
And here is the Managed Bean
@Named(value = "orderInfo")
@ViewScoped
public class OrderInfo implements Serializable {
private OrderPath[] selectedDepartments;
private Date orderInfo_Day;
// get and set methods...
}
The OrderPath is a plain object class
public class OrderPath implements Serializable {
//..
}
And the error message is:
/testorder.xhtml @49,127 selection="#{orderInfo.selectedDepartments}": Target Unreachable, identifier 'orderInfo' resolved to null
I tried with p:commandButton and h:commandButton, but got the same error.