1

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.

  • Try this link. Scroll down to the answer with the highest vote http://stackoverflow.com/questions/9809511/java-ee-6-target-unreachable-identifier-hellobean-resolved-to-null – Andy Jul 14 '13 at 04:57
  • I use Netbeans7.3.1. Because some pages work as expected, I think IDE shouldn't be the cause. – user2449972 Jul 15 '13 at 02:40
  • Ok, and can I see your import statements for OrderInfo – Andy Jul 15 '13 at 06:22
  • @user2449972 : I disagree with you : IDE could be the cause. I have got some problems with Eclipse and one of my project. try IntelliJ to see if you have got the same error. – willome Jul 15 '13 at 08:26
  • @willome I doubt it. He said some pages work as expected. Could simply be a logic error somewhere. – Andy Jul 15 '13 at 14:46
  • @Andy : on one of my project (JSF mainly), most of the pages work as expected. But sometimes (randomly), we have got the famous "target unreachable". But everything works fine when deployed on ther server or with intellij or with some older eclipse (prior to juno). So yes IDE could be the cause. – willome Jul 15 '13 at 15:02
  • here is import classes for OrderInfo : 'import java.io.Serializable; import java.sql.Date; import javax.faces.bean.ViewScoped; import javax.inject.Named;' – user2449972 Jul 17 '13 at 01:11
  • Thanks for all suggestions, I will try again. I use glassfish 4.0 recently and found some import classes are different from ones with tomcat web server. – user2449972 Jul 17 '13 at 01:25
  • 1
    thanks for Andy and Willome. I mixed the JSF managed Beans and CDI. Finally I changed all beans to CDI, and it works now. – user2449972 Jul 25 '13 at 08:20

0 Answers0